diff --git a/.maestro/child-sheets.yaml b/.maestro/child-sheets.yaml new file mode 100644 index 000000000..981a40036 --- /dev/null +++ b/.maestro/child-sheets.yaml @@ -0,0 +1,71 @@ +appId: com.lodev09.truesheet.expo +--- + +- launchApp: + clearState: true + +- waitForAnimationToEnd: + timeout: 3000 + +# Expand main sheet +- swipe: + start: "50%, 90%" + end: "50%, 30%" + duration: 500 +- waitForAnimationToEnd + +# --- BasicSheet: header, footer, detent resize, dismiss --- + +- tapOn: "TrueSheet View" +- waitForAnimationToEnd + +- assertVisible: "Enter some text..." +- assertVisible: "FOOTER" +- assertVisible: "Add Content" + +# Resize detents +- tapOn: "Large" +- waitForAnimationToEnd +- tapOn: "Auto" +- waitForAnimationToEnd + +- tapOn: "Dismiss" +- waitForAnimationToEnd +- assertVisible: "True Sheet" + +# --- PromptSheet: scrollable, form inputs --- + +- scrollUntilVisible: + element: "Prompt" + direction: DOWN +- tapOn: "Prompt" +- waitForAnimationToEnd + +- assertVisible: "First name" +- assertVisible: "Last name" +- tapOn: "First name" +- inputText: "John" +- tapOn: "Last name" +- inputText: "Doe" + +- scrollUntilVisible: + element: "Dismiss" + direction: DOWN +- tapOn: "Dismiss" +- waitForAnimationToEnd +- assertVisible: "True Sheet" + +# --- FlatListSheet: scrollable content --- + +- tapOn: "FlatList" +- waitForAnimationToEnd + +- assertVisible: "Enter some text..." +- assertVisible: "Item #0" + +- scrollUntilVisible: + element: "Item #9" + direction: DOWN +- assertVisible: "Item #9" + + diff --git a/.maestro/main-sheet.yaml b/.maestro/main-sheet.yaml new file mode 100644 index 000000000..b157daacc --- /dev/null +++ b/.maestro/main-sheet.yaml @@ -0,0 +1,44 @@ +appId: com.lodev09.truesheet.expo +--- + +- launchApp: + clearState: true + +- waitForAnimationToEnd: + timeout: 3000 + +# --- initialDetentIndex + dismissible=false --- + +# Main sheet auto-presents collapsed (header only) +- assertVisible: "True Sheet" +- assertVisible: "Enter some text..." + +# Try to swipe down — main sheet is not dismissible +- swipe: + start: "50%, 90%" + end: "50%, 99%" + duration: 300 +- waitForAnimationToEnd +- assertVisible: "True Sheet" + +# --- Expand and verify content --- + +- swipe: + start: "50%, 90%" + end: "50%, 30%" + duration: 500 +- waitForAnimationToEnd + +- assertVisible: "TrueSheet View" +- assertVisible: "Prompt" +- assertVisible: "ScrollView" +- assertVisible: "FlatList" + +# --- Expand to full, then dismiss --- + +- tapOn: "Expand" +- waitForAnimationToEnd +- tapOn: "Dismiss" +- waitForAnimationToEnd + +- assertNotVisible: "True Sheet" diff --git a/CHANGELOG.md b/CHANGELOG.md index 926df0205..835a29d7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ ### 🎉 New features -- **iOS**: Enable synchronous state update for RN 0.82+. ([#505](https://github.com/lodev09/react-native-true-sheet/pull/505) by [@lodev09](https://github.com/lodev09)) +- **iOS**: Enable synchronous state update for RN 0.82+. ([#505](https://github.com/lodev09/react-native-true-sheet/pull/505), [#507](https://github.com/lodev09/react-native-true-sheet/pull/507) by [@lodev09](https://github.com/lodev09)) - Added `maxContentWidth` prop to control the maximum width of the sheet content. ([#495](https://github.com/lodev09/react-native-true-sheet/pull/495) by [@lodev09](https://github.com/lodev09)) - Added `anchor` and `anchorOffset` props for side sheet positioning. ([#496](https://github.com/lodev09/react-native-true-sheet/pull/496), [#500](https://github.com/lodev09/react-native-true-sheet/pull/500) by [@lodev09](https://github.com/lodev09)) diff --git a/ios/TrueSheetView.mm b/ios/TrueSheetView.mm index 0e934f045..c042f23df 100644 --- a/ios/TrueSheetView.mm +++ b/ios/TrueSheetView.mm @@ -290,16 +290,11 @@ - (void)updateStateWithSize:(CGSize)size { stateData.containerWidth = static_cast(size.width); stateData.containerHeight = static_cast(size.height); - // RN 0.82+ processes state updates in the same layout pass (synchronous). - // TODO: Once stable, we can drop native layout constraints in favor of synchronous Yoga layout. - auto updateMode = #if REACT_NATIVE_VERSION_MINOR >= 82 - facebook::react::EventQueue::UpdateMode::unstable_Immediate; + _state->updateState(std::move(stateData), facebook::react::EventQueue::UpdateMode::unstable_Immediate); #else - facebook::react::EventQueue::UpdateMode::Asynchronous; + _state->updateState(std::move(stateData)); #endif - - _state->updateState(std::move(stateData), updateMode); } - (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {