Skip to content

Commit

Permalink
Add logging-debug setup
Browse files Browse the repository at this point in the history
  • Loading branch information
kkafar committed Nov 22, 2024
1 parent b2a561d commit dfa3a66
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions android/src/main/java/com/swmansion/rnscreens/Screen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.pm.ActivityInfo
import android.graphics.Paint
import android.os.Parcelable
import android.util.Log
import android.util.SparseArray
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -376,6 +377,7 @@ class Screen(
var nativeBackButtonDismissalEnabled: Boolean = true

fun startRemovalTransition() {
Log.w(TAG, "$this startRemovalTransition")
// isBeingRemoved is marked as volatile to ensure memory ordering.
// Synchronization is not required, because this method is called either from commit hook
// running on JS thread (before mounting) or from mounting code running on UI thread.
Expand All @@ -391,12 +393,16 @@ class Screen(
if (!isBeingRemoved) {
isBeingRemoved = true
if (!reactContext.isOnUiQueueThread) {
Log.w(TAG, "$this startRemovalTransition schedule")
reactContext.runOnUiQueueThread {
Log.w(TAG, "$this startRemovalTransition exec")
startTransitionRecursive(this)
}
} else {
Log.w(TAG, "$this startRemovalTransition sync")
startTransitionRecursive(this)
}
// startTransitionRecursive(this)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.swmansion.rnscreens

import android.util.Log
import android.view.View
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.annotations.ReactModule
Expand Down Expand Up @@ -46,6 +47,7 @@ class ScreenStackViewManager :
}

private fun prepareOutTransition(screen: Screen?) {
Log.w("StackViewManager", "$screen startRemovalTransition")
screen?.startRemovalTransition()
}

Expand Down
8 changes: 4 additions & 4 deletions apps/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { enableFreeze } from 'react-native-screens';
import Example from './Example';
// import * as Test from './src/tests';
// import Example from './Example';
import * as Test from './src/tests';

enableFreeze(true);

export default function App() {
return <Example />;
// return <Test.Test42 />;
// return <Example />;
return <Test.Test2282 />;
}
5 changes: 3 additions & 2 deletions apps/src/tests/Test2282.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ function Home({ navigation }: any) {
);
}

function ListScreen() {
function ListScreen({ navigation }: any) {
return (
<View
style={{ flex: 1, backgroundColor: 'slateblue' }}
removeClippedSubviews>
<ParentFlatlist />
<View removeClippedSubviews>
<View style={{ backgroundColor: 'pink', width: '100%', height: 50 }} />
<Button title='Go back' onPress={() => navigation.goBack()} />
</View>
<ParentFlatlist horizontal />
</View>
Expand Down Expand Up @@ -140,7 +141,7 @@ export default function App(): React.JSX.Element {
<NavigationContainer>
<Stack.Navigator screenOptions={{ animation: 'slide_from_right' }}>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="List" component={ListScreenSimplified}/>
<Stack.Screen name="List" component={ListScreen}/>
</Stack.Navigator>
</NavigationContainer>
);
Expand Down

0 comments on commit dfa3a66

Please sign in to comment.