我在反应原生 textInput 时遇到了一些问题。
在我添加 createBottomTabNavigation 之前,TextInput 工作正常。它在 IOS 上运行良好,但在 Android 上运行良好。我创建了一个示例组件,但问题仍然存在。这里的问题:
这是我真实 android 设备上的问题图像: react-native android app
这是我的代码:
import React from 'react';
import 'react-native-gesture-handler';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
TouchableOpacity,
TextInput,
} from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { useNavigation } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import Ionicons from 'react-native-vector-icons/Ionicons';
import ContextApp from '../../context/contextApp';
import PremiumScreen from './premiumScreen';
import SettingsPage from '../setting/settingsPage';
import ProfileContainer from '../profile/profileContainer'; …Run Code Online (Sandbox Code Playgroud) 我正在创建一个允许用户保存小数据的应用程序。我的资产文件夹中有一个 json 文件,我想创建一个可以向其中写入更多 json 数据的应用程序。路径:assets/vault.json
金库.json
[
{
"name":"Ash",
"age":"22",
"hobby" : "golf"
},
{
"name":"philip",
"age":"17",
"hobby" : "fishing"
},
{
"name":"charles",
"age":"32",
"hobby" : "drawing"
}
]
Run Code Online (Sandbox Code Playgroud)
但是我坚持向 json 文件添加更多列表。
在我的 main.dart 中,我创建了 3 个用于输入的文本字段和一个用于触发 writeToFile(arg1,arg2,arg3) 的按钮 onPress。
这是我尝试过的:
void writeToFile(String hobbyy, String agee, String namee) {
print("Writing to file!");
Map<String, dynamic> content = new Map();
content1 = {name: namee};
content2 = {age: agee};
content3 = {hobby: hobbyy};
content.addAll(content1);
content.addAll(content2);
content.addAll(content3);
print(content); //working fine
}
Future<String> _loadAVaultAsset() async …Run Code Online (Sandbox Code Playgroud)