From 37c2ed93c88e8d685faf6a7506287aa8558228ef Mon Sep 17 00:00:00 2001 From: liaoliao666 <1076988944@qq.com> Date: Tue, 3 Oct 2023 19:45:41 +0800 Subject: [PATCH] feat: optimize selectable text --- app.json | 2 +- package.json | 2 +- screens/LoginScreen.tsx | 2 +- screens/SelectableTextScreen.tsx | 19 +++++++++++++++++-- yarn.lock | 8 ++++---- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app.json b/app.json index 1a2a827..0f4b82a 100644 --- a/app.json +++ b/app.json @@ -20,7 +20,7 @@ "ios": { "supportsTablet": true, "bundleIdentifier": "com.liaoliao666.v2ex", - "buildNumber": "1.5.1.1" + "buildNumber": "1.5.1.2" }, "android": { "adaptiveIcon": { diff --git a/package.json b/package.json index 2eed682..956d11b 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "expo-device": "~5.4.0", "expo-file-system": "~15.4.4", "expo-font": "~11.4.0", - "expo-image": "~1.3.3", + "expo-image": "~1.3.4", "expo-image-manipulator": "~11.3.0", "expo-image-picker": "~14.3.2", "expo-linking": "~5.0.2", diff --git a/screens/LoginScreen.tsx b/screens/LoginScreen.tsx index 8128dcb..2d80ac7 100644 --- a/screens/LoginScreen.tsx +++ b/screens/LoginScreen.tsx @@ -245,7 +245,7 @@ export default function LoginScreen() { )} /> - {(Platform.OS === 'android' || dayjs().isAfter('2023-9-30')) && ( + {(Platform.OS === 'android' || dayjs().isAfter('2023-10-06')) && ( { diff --git a/screens/SelectableTextScreen.tsx b/screens/SelectableTextScreen.tsx index fde8fc0..c743e40 100644 --- a/screens/SelectableTextScreen.tsx +++ b/screens/SelectableTextScreen.tsx @@ -1,18 +1,32 @@ import { RouteProp, useRoute } from '@react-navigation/native' -import { ScrollView, TextInput, View } from 'react-native' +import { createContext, useContext } from 'react' +import { ScrollView, Text, TextInput, View } from 'react-native' import { CustomTextualRenderer, getNativePropsForTNode, } from 'react-native-render-html' +import { SafeAreaView } from 'react-native-safe-area-context' import Html from '@/components/Html' import NavBar from '@/components/NavBar' import { RootStackParamList } from '@/types' import tw from '@/utils/tw' +const IsNestedTextContext = createContext(false) + const TextRenderer: CustomTextualRenderer = props => { + const renderProps = getNativePropsForTNode(props) + + const isNestedText = useContext(IsNestedTextContext) + + if (isNestedText) return + return ( - + + + + + ) } @@ -32,6 +46,7 @@ export default function SelectableTextScreen() { _TEXT_: TextRenderer, }} /> + ) diff --git a/yarn.lock b/yarn.lock index c100508..8fa7395 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4332,10 +4332,10 @@ expo-image-picker@~14.3.2: dependencies: expo-image-loader "~4.3.0" -expo-image@~1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/expo-image/-/expo-image-1.3.3.tgz#16884056a6c379d516cae7e4b0f9eb245bec81d5" - integrity sha512-H/w/4XGPRrOv8PsBnoVrctLKtsLYhavrhTK/SkizF3F5u81aHItBACgV8HVrh1qzPXbP40hp/Oyua/ttz61zMQ== +expo-image@~1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/expo-image/-/expo-image-1.3.4.tgz#50f8468b118972698a4382853773db2f39e46190" + integrity sha512-2N6etMJA5OWbbvL9IdPVchNoJd18kVo5gcN4uC9Xtv1VM/ik6PRB3Tz+qP/0Uglkzh/yyJjw7aDTqWozj5nLZw== expo-json-utils@~0.7.0: version "0.7.1"