我在我的 React Native 應用程式中使用 reat natiev 紙作為大綱文本輸入所以下面是我的代碼
const TextInput = ({...props }) => (
<View style={styles.container}>
<Input
style={styles.input}
selectionColor={colors.black}
underlineColor="transparent"
mode="outlined"
autoCapitalize="none"
activeOutlineColor={colors.black60}
{...props}
/>
</View>
);
const styles = StyleSheet.create({
container: {
width: '100%',
// marginBottom: 5,
},
input: {
backgroundColor: colors.white,
fontSize: commonTheme.TEXT_SIZE_DEFAULT,
fontFamily: globals.RobotoRegular,
},
});
匯出默認文本輸入;
這是我在 textinput 組件上方呼叫的主要 tsx 檔案
<TextInput
label="Email"
value={values.email}
keyboardType="email-address"
placeholder="Enter Address"
onChangeText={handleChange('email')}
onBlur={handleBlur('email')}
textContentType="emailAddress"
/>
當我在 Android 11 OS 設備上運行上面的代碼時,當我當時專注于使用時,文本輸入不顯示

uj5u.com熱心網友回復:
我看到您遇到的問題可能是因為您的設備啟用了黑暗模式。
通常我們面臨的設計問題是因為黑暗模式。
在暗模式的情況下,主要有兩種方法來處理設計。
- 要么你必須用你的代碼同時支持暗模式和亮模式
- 或者您必須為您的應用程式設定強光模式
要強制應用程式在亮模式下作業,即使設備已啟用暗模式:
在 styles.xml 檔案中的基本應用程式主題的標記內添加以下代碼行:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
...
<item name="android:forceDarkAllowed">false</item>
</style>
</resources>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/534856.html
