Skip to content

Commit 72be6d9

Browse files
committed
chore(example): add RTL support in example
1 parent 0a3caff commit 72be6d9

File tree

4 files changed

+78
-4
lines changed

4 files changed

+78
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ react native tooltip like never before, using leading packages like `react-nativ
1919
- Far away from `Modal` issues
2020
- 60 FPS
2121
- Less boilerplate
22+
- RTL support by default (no need to worry about it)
2223
- Built for already in production app
2324
- And more...
2425

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@gorhom/portal": "^1.0.14",
1313
"expo": "~46.0.16",
1414
"expo-status-bar": "~1.4.0",
15+
"expo-updates": "~0.14.6",
1516
"react": "18.0.0",
1617
"react-native": "0.69.6",
1718
"react-native-reanimated": "~2.9.1"

example/src/App.tsx

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import React from 'react';
2+
import * as Updates from 'expo-updates';
23
import Tooltip from 'react-native-tooltiplize';
34
import { PortalProvider } from '@gorhom/portal';
4-
import { View, TouchableOpacity, StyleSheet, Text } from 'react-native';
5+
import {
6+
View,
7+
TouchableOpacity,
8+
StyleSheet,
9+
Text,
10+
I18nManager,
11+
} from 'react-native';
512

613
const App = () => {
714
const [isVisible, toggle] = React.useReducer((state) => !state, false);
@@ -16,11 +23,21 @@ const App = () => {
1623
);
1724
}, []);
1825

26+
const switchLayout = React.useCallback(() => {
27+
I18nManager.forceRTL(!I18nManager.isRTL);
28+
Updates.reloadAsync();
29+
}, []);
30+
1931
return (
2032
<PortalProvider>
2133
<View style={styles.container}>
34+
<TouchableOpacity onPress={switchLayout} style={styles.button}>
35+
<Text style={styles.newFeatureText}>
36+
{I18nManager.isRTL ? 'تغيير الواجهة' : 'Switch Layout'}
37+
</Text>
38+
</TouchableOpacity>
2239
<Tooltip
23-
position="top"
40+
position="right"
2441
offset={8}
2542
renderContent={renderContent}
2643
isVisible={isVisible}
@@ -45,6 +62,7 @@ const styles = StyleSheet.create({
4562
flex: 1,
4663
justifyContent: 'center',
4764
alignItems: 'center',
65+
paddingHorizontal: 16,
4866
},
4967
tooltipContainer: {
5068
paddingHorizontal: 16,
@@ -65,11 +83,20 @@ const styles = StyleSheet.create({
6583
},
6684
pointer: { width: 16, height: 8 },
6785
newFeature: {
68-
backgroundColor: 'white',
86+
backgroundColor: '#f1f1f1',
6987
padding: 16,
7088
borderRadius: 8,
7189
},
7290
newFeatureText: {
7391
fontSize: 16,
7492
},
93+
button: {
94+
height: 56,
95+
width: '100%',
96+
justifyContent: 'center',
97+
alignItems: 'center',
98+
backgroundColor: 'pink',
99+
borderRadius: 8,
100+
marginBottom: 16,
101+
},
75102
});

example/yarn.lock

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@
11341134
uuid "^3.4.0"
11351135
wrap-ansi "^7.0.0"
11361136

1137-
"@expo/code-signing-certificates@^0.0.2":
1137+
"@expo/code-signing-certificates@0.0.2", "@expo/code-signing-certificates@^0.0.2":
11381138
version "0.0.2"
11391139
resolved "https://registry.yarnpkg.com/@expo/code-signing-certificates/-/code-signing-certificates-0.0.2.tgz#65cd615800e6724b54831c966dd1a90145017246"
11401140
integrity sha512-vnPHFjwOqxQ1VLztktY+fYCfwvLzjqpzKn09rchcQE7Sdf0wtW5fFtIZBEFOOY5wasp8tXSnp627zrAwazPHzg==
@@ -2928,6 +2928,11 @@ expo-constants@~13.2.2, expo-constants@~13.2.4:
29282928
"@expo/config" "~7.0.0"
29292929
uuid "^3.3.2"
29302930

2931+
expo-eas-client@~0.3.0:
2932+
version "0.3.0"
2933+
resolved "https://registry.yarnpkg.com/expo-eas-client/-/expo-eas-client-0.3.0.tgz#21383fc95a52e71e13c7276456db20388fefcf95"
2934+
integrity sha512-dBD00lJ629ayh5abbmgn6I1Z5NOaWM1iea2ODLd/EF1ZcS1P3yiPm6blpvL/tD+uewL8gxxmla/Ac+SiDdYAYA==
2935+
29312936
expo-error-recovery@~3.2.0:
29322937
version "3.2.0"
29332938
resolved "https://registry.yarnpkg.com/expo-error-recovery/-/expo-error-recovery-3.2.0.tgz#3a4543382904a5e70829cb41d7fc0f022c2bef6e"
@@ -2948,11 +2953,23 @@ expo-font@~10.2.1:
29482953
dependencies:
29492954
fontfaceobserver "^2.1.0"
29502955

2956+
expo-json-utils@~0.3.0:
2957+
version "0.3.0"
2958+
resolved "https://registry.yarnpkg.com/expo-json-utils/-/expo-json-utils-0.3.0.tgz#0c4a0195ee2bbde02cbb5f4d384d1cb63bea7493"
2959+
integrity sha512-ceo0pWFJqRAsNjZWX3rVDhy+NDzmrBNFOdvW+HE4EHqlt+OEUu9INIYKO8fU+g3ifI0VcKqHfvvj5wKsSpvPBw==
2960+
29512961
expo-keep-awake@~10.2.0:
29522962
version "10.2.0"
29532963
resolved "https://registry.yarnpkg.com/expo-keep-awake/-/expo-keep-awake-10.2.0.tgz#46f04740bccd321732bbbed93491e2076d5dbbd7"
29542964
integrity sha512-kIRtO4Hmrvxh4E45IPWG/NiUZsuRe1AQwBT09pq+kx8nm6tUS4B9TeL6+1NFy+qVBLbGKDqoQD5Ez7XYTFtBeQ==
29552965

2966+
expo-manifests@~0.3.0:
2967+
version "0.3.1"
2968+
resolved "https://registry.yarnpkg.com/expo-manifests/-/expo-manifests-0.3.1.tgz#52c3ef41d3b1958039be0434363e6499c773aaf6"
2969+
integrity sha512-zv2a4pzhbvxVjrTO4XEiP5THt4RwtxyJjfixFhDNfHtDQR7fS4h9sZSGX9ind+IS5SQJQ2ykfVAi8xnwP6zHaw==
2970+
dependencies:
2971+
expo-json-utils "~0.3.0"
2972+
29562973
29572974
version "0.10.3"
29582975
resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-0.10.3.tgz#31bfcf3e4b613a7c3949fb1f1e9c23eea4c14caf"
@@ -2977,6 +2994,34 @@ expo-status-bar@~1.4.0:
29772994
resolved "https://registry.yarnpkg.com/expo-status-bar/-/expo-status-bar-1.4.0.tgz#c0317de2c53878340f4b4f00ff7e4ba14399a7fb"
29782995
integrity sha512-vh98g8qMIjig/2XTBsoAWS6Vo2dIIwDWjB3/GiuZ9Lazpxc9GO/APfJ4dar7MibzIDUKIrjotrcL6rLdPH13Ew==
29792996

2997+
expo-structured-headers@~2.2.0:
2998+
version "2.2.1"
2999+
resolved "https://registry.yarnpkg.com/expo-structured-headers/-/expo-structured-headers-2.2.1.tgz#739f969101de6bead921eee59e5899399ad67715"
3000+
integrity sha512-nY6GuvoS/U5XdhfBNmvXGRoGzIXywXpSZs2wdiP+FbS79P9UWyEqzgARrBTF+6pQxUVMs6/vdffxRpwhjwYPug==
3001+
3002+
expo-updates-interface@~0.7.0:
3003+
version "0.7.0"
3004+
resolved "https://registry.yarnpkg.com/expo-updates-interface/-/expo-updates-interface-0.7.0.tgz#f4f03b61dbdd949cac9fb44e250e1162ba177650"
3005+
integrity sha512-saThnbrYDSjKxfMFFguAvh5o5KGabvAOHItkJRwq2L3c0T/3q26Q0kM83880h/+TTtAVsl1+Vhny9d+ImD3yvQ==
3006+
3007+
expo-updates@~0.14.6:
3008+
version "0.14.6"
3009+
resolved "https://registry.yarnpkg.com/expo-updates/-/expo-updates-0.14.6.tgz#bf2318dd58f1c293c0f7e463a6f942e3ca511a79"
3010+
integrity sha512-JmE3nsbL8cUAV2slhIqqNIG+jEYCJJvPzSYcUBd15s0sg0xxRbasNaEfnSIrYtZMjhl/YNwMgQzUkU6C2NtXyg==
3011+
dependencies:
3012+
"@expo/code-signing-certificates" "0.0.2"
3013+
"@expo/config" "~7.0.1"
3014+
"@expo/config-plugins" "~5.0.1"
3015+
"@expo/metro-config" "~0.4.0"
3016+
arg "4.1.0"
3017+
expo-eas-client "~0.3.0"
3018+
expo-manifests "~0.3.0"
3019+
expo-structured-headers "~2.2.0"
3020+
expo-updates-interface "~0.7.0"
3021+
fbemitter "^3.0.0"
3022+
resolve-from "^5.0.0"
3023+
uuid "^3.4.0"
3024+
29803025
expo@~46.0.16:
29813026
version "46.0.16"
29823027
resolved "https://registry.yarnpkg.com/expo/-/expo-46.0.16.tgz#8fe6d10207dabda34a684efac2c45c3c1c089f11"

0 commit comments

Comments
 (0)