Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e17e36b
docs: point the Maestro README at a real flow path
diegolmello Oct 15, 2026
752db23
chore: log e2e flows in through Appduct instead of clearState and a d…
diegolmello Oct 16, 2026
71e80e4
fix: confirm the iOS open-link prompt and settle taps after re-render…
diegolmello Oct 16, 2026
1ae3ec3
chore: reset the app and open setup rooms through Appduct in e2e flows
diegolmello Oct 16, 2026
c6def15
fix: recover e2e setup from a hung app and a slow Appduct daemon start
diegolmello Oct 16, 2026
74a76fe
fix: reset the app through Appduct while a screen lock blocks startup
diegolmello Oct 16, 2026
af2ee09
chore: keep the deep link login in e2e flows and use Appduct only to …
diegolmello Oct 16, 2026
cc42cbf
chore: link Appduct into e2e Release builds through RUNNING_E2E_TESTS
diegolmello Oct 16, 2026
62ae090
chore: open setup rooms through Appduct in the remaining e2e flows
diegolmello Oct 16, 2026
d392152
fix: convert private groups to teams with the room id alone on 4.8.0+
diegolmello Oct 16, 2026
4400486
fix: wait for the inside navigator before Appduct navigates
diegolmello Oct 16, 2026
0e28810
chore: stabilize Profile, Room and Keyboard Navigation Components e2e…
diegolmello Oct 16, 2026
02c0e1b
chore: retry every add-reaction tap in Room and restore Keyboard Navi…
diegolmello Oct 17, 2026
8d1ea0f
fix: redact e2e logs even when the Appduct bridge has already exited
diegolmello Oct 19, 2026
5b410fe
fix: let Appduct open a room after a share and reopen it from the roo…
diegolmello Oct 19, 2026
33dab8d
chore: open subscribed rooms through Appduct in Room Info and Join Pu…
diegolmello Oct 19, 2026
5594794
chore: simplify e2e signing env, bridge body parsing, team selection …
diegolmello Oct 19, 2026
1d0701f
Merge remote-tracking branch 'origin/develop' into chore/e2e-appduct
diegolmello Oct 21, 2026
17483f3
chore: keep Maestro helpers develop still tracks
diegolmello Oct 21, 2026
4ae3ecd
chore: open subscribed rooms through Appduct in e2e tests
diegolmello Oct 21, 2026
35de921
chore: create the direct message through the API before opening it in…
diegolmello Oct 21, 2026
fd3d586
chore: keep the search path for a room the e2e user still has to join
diegolmello Oct 21, 2026
8a9e090
chore: retry going back when the back button re-renders before the tap
diegolmello Oct 21, 2026
75d11fb
chore: connect e2e tests to Appduct through the @appduct/e2e fixture
diegolmello Oct 22, 2026
8bb337c
chore: update the Appduct pod to 0.16.0
diegolmello Oct 22, 2026
fa7cd22
chore: point e2e test authors at the shared Appduct fixtures
diegolmello Oct 22, 2026
5fbe784
Merge remote-tracking branch 'origin/develop' into chore/e2e-appduct
diegolmello Oct 22, 2026
3c5ada4
chore: add share-tapped screenshot
diegolmello Oct 22, 2026
dd68afd
chore: remove accidentally committed screenshot
diegolmello Oct 23, 2026
ea0f22e
test(e2e): add custom categories coverage (#7831)
diegolmello Oct 23, 2026
c356c75
Merge branch 'develop' into chore/e2e-appduct
diegolmello Oct 23, 2026
0502e07
Merge branch 'develop' into chore/e2e-appduct
diegolmello Oct 23, 2026
7581a43
test(e2e): log in through Appduct reset instead of clearing app data
diegolmello Oct 26, 2026
f1e1d6e
chore: link Appduct into e2e Release builds through APPDUCT_ENABLED a…
diegolmello Oct 27, 2026
0dfdc78
Merge branch 'develop' into chore/e2e-appduct
diegolmello Nov 16, 2026
ac1fae5
fix: disconnect from the workspace in reset_app and address review fi…
diegolmello Nov 16, 2026
c16a095
fix: check the joined room's row, disconnect before removing workspac…
diegolmello Nov 17, 2026
bcc5b26
fix: fail e2e login on broken Appduct tools, skip it behind the scree…
diegolmello Nov 17, 2026
fc21491
fix: open the poll room from the rooms list row in the poll e2e test
diegolmello Nov 18, 2026
4062825
revert: open the poll room through Appduct again in the poll e2e test
diegolmello Nov 18, 2026
3a4ed8c
fix: keep an updated message's content in the iOS accessibility tree …
diegolmello Nov 18, 2026
e7c2742
Merge remote-tracking branch 'origin/develop' into chore/e2e-appduct
diegolmello Nov 23, 2026
f1e0a6d
fix: let Appduct reset the app from the share extension
diegolmello Nov 23, 2026
144fff7
chore: load Appduct tools only under APPDUCT_ENABLED and tidy e2e hel…
diegolmello Nov 24, 2026
8783321
fix: keep updated message content in the iOS accessibility order with…
diegolmello Nov 24, 2026
4171e69
fix: close action sheets and loading overlays in reset_app
diegolmello Nov 24, 2026
deae3a4
Merge branch 'develop' into chore/e2e-appduct
diegolmello Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schemaVersion":"trace-1","createdAt":"2026-10-23T03:08:30.830Z","payload":{"actions":[{"name":"type","summary":"type \"https://mobile.qa.rocket.chat\" into textbox \"Workspace URL. Required.\" in \"Workspace URL (Required)\"","target":{"role":"textbox","name":"Workspace URL. Required.","testId":"new-server-view-input","selector":"id=new-server-view-input","within":"Workspace URL (Required)"},"value":"https://mobile.qa.rocket.chat"},{"name":"tap","summary":"tap button \"Connect\" in \"Add workspace\"","target":{"role":"button","name":"Connect","testId":"new-server-view-button","selector":"id=new-server-view-button","within":"Add workspace"}}],"executor":{"name":"claude-subscription","version":"1"},"recordedFor":{"testId":"e2e/tests/onboarding/workspace/valid-workspace.e2e.ts::connects%20to%20a%20valid%20workspace","targetId":"android","instructionDigest":"6f978e514a0fe87a163de266f59b2f4fc8cb02efa211732d1625c5a1b709bce8","paramsDigest":"5815369c679653d3cadfeda8f12c9a0bdc5b2695a283eeb10d158904d2749447","callIndex":0,"agent":"default"},"summary":"Entered https://mobile.qa.rocket.chat and tapped Connect; app navigated to the workspace screen showing \"Mobile!\" with the correct URL and Login/Create account options.","startPath":"chat.rocket.android","endPath":"chat.rocket.android","endAnchors":[{"role":"text","name":"mobile.qa.rocket.chat"},{"role":"text","name":"Mobile!"},{"role":"text","name":"https://mobile.qa.rocket.chat"},{"role":"text","name":"Login"},{"role":"text","name":"Create an account"},{"role":"button","name":"Back","testId":"custom-header-back"},{"role":"group","testId":"workspace-view"},{"role":"button","name":"Login","testId":"workspace-view-login"}],"goneAnchors":[{"role":"text","name":"Add workspace"},{"role":"text","name":"Workspace URL (Required)"},{"role":"textbox","name":"Workspace URL. Required.","testId":"new-server-view-input"},{"role":"text","name":"Connect"},{"role":"text","name":"Do you have a certificate for this workspace?"},{"role":"text","name":"Apply certificate"},{"role":"group","testId":"new-server-view"},{"role":"button","name":"Connect","testId":"new-server-view-button"}],"endWaitMs":18794,"keyedBy":{"cacheSchema":"trace-1","policyVersion":"conservative/6","project":"e10bb8295a8f5afae0b297d7a91adcf42448de124f3d41c6f4831d6e6ce82456","platform":"android","engineName":"mobile","engineSpiVersion":1,"appIdentity":"d6c75fa95aa15a64370ab158bde1baedd605248023914ac65d8a60cf89dd1286","agentContextDigest":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}}}
Comment thread
diegolmello marked this conversation as resolved.
Resolved
Comment thread
diegolmello marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schemaVersion":"trace-1","createdAt":"2026-10-23T03:29:40.734Z","payload":{"actions":[{"name":"type","summary":"type \"https://mobile.qa.rocket.chat\" into textbox \"Workspace URL. Required.\"","target":{"role":"textbox","name":"Workspace URL. Required.","testId":"new-server-view-input","selector":"id=new-server-view-input"},"value":"https://mobile.qa.rocket.chat"},{"name":"tap","summary":"tap button \"Connect\"","target":{"role":"button","name":"Connect","testId":"new-server-view-button","selector":"id=new-server-view-button"}}],"executor":{"name":"claude-subscription","version":"1"},"recordedFor":{"testId":"e2e/tests/onboarding/workspace/valid-workspace.e2e.ts::connects%20to%20a%20valid%20workspace","targetId":"ios","instructionDigest":"6f978e514a0fe87a163de266f59b2f4fc8cb02efa211732d1625c5a1b709bce8","paramsDigest":"5815369c679653d3cadfeda8f12c9a0bdc5b2695a283eeb10d158904d2749447","callIndex":0,"agent":"default"},"summary":"Entered https://mobile.qa.rocket.chat and tapped Connect; app navigated to the workspace view showing \"Mobile!\" with Login and Create an account options, confirming successful connection.","startPath":"chat.rocket.ios","endPath":"chat.rocket.ios / mobile.qa.rocket.chat","endAnchors":[{"role":"button","name":"NewServerView","testId":"BackButton"},{"role":"text","name":"mobile.qa.rocket.chat"},{"role":"navigation","testId":"mobile.qa.rocket.chat"},{"role":"other","testId":"workspace-view"},{"role":"text","name":"Mobile!"},{"role":"text","name":"https://mobile.qa.rocket.chat"},{"role":"button","name":"Login"},{"role":"text","name":"Login"}],"goneAnchors":[{"role":"text","name":"Workspace URL (Required)"},{"role":"textbox","name":"Workspace URL. Required.","testId":"new-server-view-input"},{"role":"other","testId":"new-server-view"},{"role":"text","name":"Add workspace"},{"role":"button","name":"Connect"},{"role":"text","name":"Connect"},{"role":"text","name":"Do you have a certificate for this workspace?"},{"role":"button","name":"Apply certificate"}],"endWaitMs":15624,"keyedBy":{"cacheSchema":"trace-1","policyVersion":"conservative/6","project":"e10bb8295a8f5afae0b297d7a91adcf42448de124f3d41c6f4831d6e6ce82456","platform":"ios","engineName":"mobile","engineSpiVersion":1,"appIdentity":"3e1aa78299231980953f72b3a8464e56029f7e6ed4881ffb1e58f48196f1cd53","agentContextDigest":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}}}
4 changes: 4 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ The shard jobs in [e2e-android.yml](workflows/e2e-android.yml) and [e2e-ios.yml]
| `E2E_ACCOUNT` | Base64 of the e2e account definition; [e2e-account](actions/e2e-account/action.yml) turns it into masked `E2E_*` credential env vars |
| `CLAUDE_CODE_OAUTH_TOKEN` | Claude subscription token for the agent steps; exposed only to the run step |

## Appduct in E2E builds

The E2E build workflows set `APPDUCT_ENABLED=1`, which links Appduct into their Release builds and loads the app's Appduct tools, so e2e tests can do setup, such as opening rooms, through those tools instead of the UI. They also set `RUNNING_E2E_TESTS=true`, which turns on the app's e2e test behaviour. Never set either in a workflow whose build can ship. The E2E APK is signed with a keystore generated for the run, so it can't install over a store build, and its artifact is kept for two days.

## E2E native build cache

The E2E build workflows hash each platform's native inputs with `@expo/fingerprint` (configured in `fingerprint.config.js`). When a native build is cached under that fingerprint, the job rebuilds only the JS bundle and swaps it into the cached APK or simulator app. Otherwise it does a full native build and caches it. Patches count for both platforms unless every file they touch belongs to the other one. Android's fingerprint also hashes the images and sounds under `app/`, because they are compiled into the APK's resources; if a dependency's images differ from the cached build's, Android falls back to a full build.
35 changes: 16 additions & 19 deletions .github/workflows/e2e-build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ name: E2E Build Android
on:
workflow_call:
secrets:
KEYSTORE_OFFICIAL_BASE64:
required: true
KEYSTORE_OFFICIAL_PASSWORD:
required: true
KEYSTORE_OFFICIAL_ALIAS:
required: true
BUGSNAG_KEY_OFFICIAL:
required: true
inputs:
Expand All @@ -19,6 +13,10 @@ on:

permissions: {}

env:
RUNNING_E2E_TESTS: true
APPDUCT_ENABLED: 1

jobs:
native-fingerprint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -53,6 +51,10 @@ jobs:
env:
APK_PATH: android/app/build/outputs/apk/release/app-release.apk
REACT_RES_DIR: android/app/build/generated/res/react/release
KEYSTORE_PATH: android/app/release.keystore
KEYSTORE_PASSWORD: e2e-throwaway
KEY_PASSWORD: e2e-throwaway
KEY_ALIAS: e2e

outputs:
artifact_name: Android APK
Expand Down Expand Up @@ -97,9 +99,11 @@ jobs:
with:
gradle-version: wrapper

- name: Decode Keystore
- name: Create throwaway keystore
run: |
echo "${{ secrets.KEYSTORE_OFFICIAL_BASE64 }}" | base64 -d > android/app/release.keystore
keytool -genkeypair -noprompt -keystore "$KEYSTORE_PATH" \
-storepass "$KEYSTORE_PASSWORD" -keypass "$KEY_PASSWORD" -alias "$KEY_ALIAS" \
-keyalg RSA -keysize 2048 -validity 7 -dname "CN=Rocket.Chat E2E"

- name: Swap JS bundle into cached APK
id: swap
Expand All @@ -113,12 +117,6 @@ jobs:
mkdir -p "$(dirname "$APK_PATH")"
.github/scripts/swap-android-bundle.sh .native-cache/app-release.apk android/app/build/generated/assets/react/release/index.android.bundle "$APK_PATH"
echo "swapped=true" >> "$GITHUB_OUTPUT"
env:
RUNNING_E2E_TESTS: true
KEYSTORE_PATH: android/app/release.keystore
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_OFFICIAL_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEYSTORE_OFFICIAL_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEYSTORE_OFFICIAL_PASSWORD }}

- name: Cache Android build
if: ${{ steps.swap.outputs.swapped != 'true' }}
Expand All @@ -139,17 +137,15 @@ jobs:
echo -e "reactNativeArchitectures=arm64-v8a,x86_64" >> ./gradle.properties
echo -e "VERSIONCODE=999999" >> ./gradle.properties
echo -e "KEYSTORE=release.keystore" >> ./gradle.properties
echo -e 'KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_OFFICIAL_PASSWORD }}' >> ./gradle.properties
echo -e 'KEY_ALIAS=${{ secrets.KEYSTORE_OFFICIAL_ALIAS }}' >> ./gradle.properties
echo -e 'KEY_PASSWORD=${{ secrets.KEYSTORE_OFFICIAL_PASSWORD }}' >> ./gradle.properties
echo -e "KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD" >> ./gradle.properties
echo -e "KEY_ALIAS=$KEY_ALIAS" >> ./gradle.properties
echo -e "KEY_PASSWORD=$KEY_PASSWORD" >> ./gradle.properties
echo -e 'BugsnagAPIKey=${{ secrets.BUGSNAG_KEY_OFFICIAL }}' >> ./gradle.properties

- name: Build Android Release APK
if: ${{ steps.swap.outputs.swapped != 'true' }}
working-directory: android
run: ./gradlew assembleRelease --build-cache --parallel --max-workers=4 --no-daemon --stacktrace
env:
RUNNING_E2E_TESTS: true

- name: Prepare native build for cache
if: ${{ steps.native-cache.outputs.cache-hit != 'true' }}
Expand All @@ -171,3 +167,4 @@ jobs:
with:
name: Android APK
path: ${{ env.APK_PATH }}
retention-days: 2
8 changes: 4 additions & 4 deletions .github/workflows/e2e-build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ on:

permissions: {}

env:
RUNNING_E2E_TESTS: true
APPDUCT_ENABLED: 1

jobs:
native-fingerprint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -79,8 +83,6 @@ jobs:
- name: Bundle JS into cached app
if: ${{ steps.native-cache.outputs.cache-hit == 'true' }}
run: .github/scripts/bundle-ios-app.sh "$APP_PATH"
env:
RUNNING_E2E_TESTS: true

- name: Set up Xcode
if: ${{ steps.native-cache.outputs.cache-hit != 'true' }}
Expand Down Expand Up @@ -139,7 +141,6 @@ jobs:
if: ${{ steps.native-cache.outputs.cache-hit != 'true' }}
run: |
cd ios
export RUNNING_E2E_TESTS=true
bundle exec fastlane ios build_simulator \
disable_xcpretty:false \
skip_package_ipa:true \
Expand All @@ -151,7 +152,6 @@ jobs:
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
FASTLANE_REPO_PAT: ${{ secrets.FASTLANE_REPO_PAT }}
RUNNING_E2E_TESTS: true

- name: Find latest xcarchive path
if: ${{ steps.native-cache.outputs.cache-hit != 'true' }}
Expand Down
1 change: 1 addition & 0 deletions .sniffler/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
".github/workflows/**",
".github/scripts/**",
"app/index.tsx",
"app/lib/appduct/**",
"app/lib/notifications/push.ts",
"app/lib/notifications/index.ts",
"app/lib/services/connect.ts",
Expand Down
13 changes: 13 additions & 0 deletions .sniffler/test-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@
"app/lib/services/connect.ts"
]
},
{
"test": "e2e/tests/assorted/custom-categories.e2e.ts",
"dependsOn": [
"app/views/CreateCategoryView/**",
"app/views/CategoryView/**",
"app/views/CategorySettingsView/**",
"app/containers/MoveToCategorySheet/**",
"app/views/RoomsListView/**",
"app/views/NewMessageView/**",
"app/views/RoomActionsView/**",
"app/lib/methods/assignRoomToCategory.ts"
]
},
{
"test": "e2e/tests/assorted/deeplink.e2e.ts",
"dependsOn": [
Expand Down
10 changes: 5 additions & 5 deletions app/containers/ActionSheet/ActionSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,189 +25,189 @@
export const ACTION_SHEET_ANIMATION_DURATION = 250;

const ActionSheet = memo(
forwardRef(({ children }: { children: ReactElement }, ref) => {
const { colors } = useTheme();
const { height: windowHeight, width: windowWidth } = useWindowDimensions();
const sheetRef = useRef<TrueSheet>(null);
const handleRef = useRef<View>(null);
const [data, setData] = useState<TActionSheetOptions>({} as TActionSheetOptions);
const [isVisible, setIsVisible] = useState(false);
const [contentHeight, setContentHeight] = useState(0);
const { bottom } = useSafeAreaInsets();
const onCloseSnapshotRef = useRef<TActionSheetOptions['onClose']>(undefined);
const dismissedOnCloseRef = useRef<TActionSheetOptions['onClose']>(undefined);

const itemHeight = useActionSheetItemHeight();

const phaseRef = useRef<'idle' | 'presenting' | 'presented' | 'dismissing'>('idle');
const desiredOptionsRef = useRef<TActionSheetOptions | null>(null);
const pendingPresentTimeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);

useEffect(() => () => clearTimeout(pendingPresentTimeoutRef.current), []);

const dismissSheet = () => sheetRef.current?.dismiss().catch(() => {});

const hide = () => {
desiredOptionsRef.current = null;
clearTimeout(pendingPresentTimeoutRef.current);
const phase = phaseRef.current;
if (phase === 'idle' || phase === 'dismissing') return;
phaseRef.current = 'dismissing';
if (phase === 'presented') {
sheetRef.current?.dismiss();
}
dismissSheet();
Keyboard.dismiss();
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
};

useEffect(() => {
if (isVisible) return;
const dismissedOnClose = dismissedOnCloseRef.current;
dismissedOnCloseRef.current = undefined;
dismissedOnClose?.();
}, [isVisible]);

// Keep contentHeight to avoid flickering on next show
const onDidDismiss = () => {
phaseRef.current = 'idle';
dismissedOnCloseRef.current = onCloseSnapshotRef.current;
onCloseSnapshotRef.current = undefined;
setIsVisible(false);
if (desiredOptionsRef.current && phaseRef.current === 'idle') {
pendingPresentTimeoutRef.current = setTimeout(presentDesiredSheet);
}
};

const presentDesiredSheet = () => {
const options = desiredOptionsRef.current;
if (!options || phaseRef.current === 'dismissing') return;
desiredOptionsRef.current = null;
setData(options);
onCloseSnapshotRef.current = options.onClose;
if (phaseRef.current !== 'idle') return;
phaseRef.current = 'presenting';
setIsVisible(true);
Keyboard.dismiss();
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
sheetRef.current?.present().catch(onDidDismiss);
};

const show = (options: TActionSheetOptions) => {
clearTimeout(pendingPresentTimeoutRef.current);
desiredOptionsRef.current = options;
presentDesiredSheet();
};

useBackHandler(() => {
if (isVisible) {
hide();
}
return isVisible;
});

useImperativeHandle(ref, () => ({
showActionSheet: show,
hideActionSheet: hide
}));

const focusHandle = () => {
const node = findNodeHandle(handleRef.current);
if (node) AccessibilityInfo.setAccessibilityFocus(node);
};

const onDidPresent = () => {
if (phaseRef.current === 'dismissing') {
sheetRef.current?.dismiss();
if (phaseRef.current !== 'presenting') {
dismissSheet();
return;
}
phaseRef.current = 'presented';
// On Android the bottom sheet is hosted in a separate window; TalkBack
// needs a moment after the present animation before it can target nodes
// inside it, so defer the focus call slightly.
if (isAndroid) {
setTimeout(focusHandle, 300);
return;
}
focusHandle();
};

const renderHeader = () => (
<GestureHandlerRootView style={{ flex: 0 }}>
<Handle ref={handleRef} onPress={hide} />
{isValidElement(data?.customHeader) ? data.customHeader : null}
</GestureHandlerRootView>
);

const isPortrait = windowHeight > windowWidth;
const effectiveSnaps = (isPortrait ? data?.portraitSnaps : data?.landscapeSnaps) || data?.snaps;

const { detents, maxHeight, scrollEnabled } = useActionSheetDetents({
windowHeight,
itemHeight,
optionsLength: data?.options?.length || 0,
snaps: effectiveSnaps,
headerHeight: data?.headerHeight,
hasCancel: data?.hasCancel,
contentHeight
});

const hasOptions = !!data?.options?.length;
const hasSnaps = !!effectiveSnaps?.length;
const disableContentPanning = data?.enableContentPanningGesture === false;
const isScrollable = hasOptions || (hasSnaps && !disableContentPanning);
const contentScrollEnabled = hasOptions ? scrollEnabled : isScrollable;

const handleContentLayout = ({ nativeEvent: { layout } }: LayoutChangeEvent) => {
const padding = getSheetContentPaddingBottom({
bottom,
fullContainer: data.fullContainer,
hugContent: data.hugContent,
scrollEnabled: contentScrollEnabled
});
setContentHeight(Math.max(0, layout.height - padding));
};

const contentMinHeight =
data.fullContainer && effectiveSnaps?.length
? (() => {
const snap = effectiveSnaps[0];
const fraction = typeof snap === 'number' ? Math.min(1, Math.max(0.1, snap)) : (parseFloat(String(snap)) || 50) / 100;
return Math.max(0, windowHeight * fraction - HANDLE_HEIGHT);
})()
: undefined;

return (
<>
{children}
<TrueSheet
ref={sheetRef}
detents={detents}
maxHeight={maxHeight}
backgroundColor={colors.surfaceLight}
cornerRadius={16}
dimmed
grabber={false}
draggable={!disableContentPanning}
header={renderHeader()}
scrollable={isScrollable}
style={styles.container}
onDidPresent={onDidPresent}
onDidDismiss={onDidDismiss}>
<GestureHandlerRootView style={styles.contentContainer}>
<BottomSheetContent
options={data?.options}
hide={hide}
hasCancel={data?.hasCancel}
onLayout={handleContentLayout}
fullContainer={data.fullContainer}
hugContent={data.hugContent}
contentMinHeight={isIOS ? contentMinHeight : undefined}
scrollEnabled={contentScrollEnabled}>
{data?.children}
</BottomSheetContent>
</GestureHandlerRootView>
</TrueSheet>
</>
);
})

Check warning on line 210 in app/containers/ActionSheet/ActionSheet.tsx

View workflow job for this annotation

GitHub Actions / ESLint and Test / run-eslint-and-test

eslint(complexity)

function has a complexity of 25. Maximum allowed is 20.
);

export default ActionSheet;
30 changes: 27 additions & 3 deletions app/containers/ActionSheet/__tests__/ActionSheet.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,47 @@ describe('ActionSheet', () => {
expect(mockPresent).toHaveBeenCalledTimes(1);
});

it('dismisses a sheet hidden before it finished presenting once the presentation ends', () => {
it('dismisses a sheet hidden before it finished presenting right away and again once the presentation ends', () => {
act(() => showActionSheetRef({ children: <Text>first sheet</Text> }));
act(() => hideActionSheetRef());
act(() => showActionSheetRef({ children: <Text>second sheet</Text> }));

expect(mockDismiss).not.toHaveBeenCalled();
expect(mockDismiss).toHaveBeenCalledTimes(1);

finishPresent();

expect(mockDismiss).toHaveBeenCalledTimes(1);
expect(mockDismiss).toHaveBeenCalledTimes(2);

finishDismiss();
act(() => jest.runAllTimers());

expect(screen.getByText('second sheet')).toBeOnTheScreen();
});

it('closes a sheet whose presentation never reports finishing', () => {
const onClose = jest.fn();
act(() => showActionSheetRef({ children: <Text>first sheet</Text>, onClose }));
act(() => hideActionSheetRef());

expect(mockDismiss).toHaveBeenCalledTimes(1);

finishDismiss();
act(() => showActionSheetRef({ children: <Text>second sheet</Text> }));

expect(onClose).toHaveBeenCalledTimes(1);
expect(screen.getByText('second sheet')).toBeOnTheScreen();
expect(mockPresent).toHaveBeenCalledTimes(2);
});

it('dismisses a sheet whose presentation finishes after it was dismissed', () => {
act(() => showActionSheetRef({ children: <Text>first sheet</Text> }));
act(() => hideActionSheetRef());
finishDismiss();
finishPresent();

expect(mockDismiss).toHaveBeenCalledTimes(2);
});

it('drops a queued sheet when hide is called again during the dismissal', () => {
act(() => showActionSheetRef({ children: <Text>first sheet</Text> }));
finishPresent();
Expand Down
8 changes: 6 additions & 2 deletions app/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,16 @@ export const setLanguage = (l: string) => {
i18n.translations = { en: translations.en?.() };
const defaultLanguage = { languageTag: 'en', isRTL: false };
const availableLanguages = Object.keys(translations);
const { languageTag } = RNLocalize.findBestLanguageTag(availableLanguages) || defaultLanguage;

export const setDeviceLanguage = () => {
const { languageTag } = RNLocalize.findBestLanguageTag(availableLanguages) || defaultLanguage;
setLanguage(languageTag);
};

// @ts-ignore
i18n.isTranslated = (text?: string) => text in englishJson;

setLanguage(languageTag);
setDeviceLanguage();
i18n.fallbacks = true;

type Ti18n = {
Expand Down
Loading
Loading