Browse Source

fix: 修复安卓手机输入框不上下剧中的问题

kuns 2 months ago
parent
commit
ceb99c4917

+ 28 - 0
app.json

@@ -86,6 +86,34 @@
                     "locationAlwaysPermission": "我們需要您的位置資訊來尋找附近的充電站。您的位置資訊只會被用於尋找充電站。我們不會儲存或共享任何資訊",
                     "locationWhenInUsePermission": "我們需要您的位置資訊來尋找附近的充電站。您的位置資訊只會被用於尋找充電站。我們不會儲存或共享任何資訊"
                 }
+            ],
+            [
+                "expo-font",
+                {
+                "fonts": ["./path/to/file.ttf"],
+                "android": {
+                    "fonts": [
+                        {
+                            "fontFamily": "Roboto-Bold",
+                            "fontDefinitions": [
+                            {
+                                "path": "./assets/fonts/Roboto-Bold.ttf",
+                                "weight": 800
+                            }
+                            ]
+                        },
+                        {
+                            "fontFamily": "Roboto-Regular",
+                            "fontDefinitions": [
+                            {
+                                "path": "./assets/fonts/Roboto-Regular.ttf",
+                                "weight": 400
+                            }
+                            ]
+                        }
+                    ]
+                }
+                }
             ]
         ],
         "extra": {

BIN
assets/fonts/Roboto-Bold.ttf


BIN
assets/fonts/Roboto-Regular.ttf


+ 1 - 1
component/global/normal_input.tsx

@@ -79,7 +79,7 @@ const NormalInput = forwardRef<TextInput, NormalInputProps>(
         return (
             <TextInput
                 ref={ref}
-                style={[styles.textInput, extendedStyle]}
+                style={[styles.textInput, extendedStyle, , {fontFamily: 'Roboto-Regular'}]}
                 placeholder={placeholder}
                 placeholderTextColor={'#888888'}
                 secureTextEntry={secureTextEntry}

+ 1 - 1
component/global/number_input.tsx

@@ -37,7 +37,7 @@ const NumberInput: React.FC<NumberInputProps> = ({ placeholder, extendedStyle, o
 					keyboardType="numeric"
 					placeholder={placeholder}
 					placeholderTextColor={"#888888"}
-					style={[styles.input]}
+					style={[styles.input, , {fontFamily: 'Roboto-Regular'}]}
 					onChangeText={(text) => validateInput(text)}
 					value={inputValue}
 					editable={editable}

+ 3 - 3
component/global/phone_input.tsx

@@ -1,6 +1,5 @@
 import React from "react";
 import { View, Text, TextInput, StyleSheet, ViewStyle, StyleProp, KeyboardTypeOptions, TextInputProps } from "react-native";
-
 interface PhoneInputProps {
 	value: string | undefined;
 	onChangeText: (text: string) => void;
@@ -24,7 +23,7 @@ const PhoneInput: React.FC<PhoneInputProps> = ({ value, onChangeText, placeholde
 					onChangeText={onChangeText}
 					keyboardType={keyboardType}
 					placeholder={placeholder}
-					style={[styles.input]}
+					style={[styles.input, {fontFamily: 'Roboto-Regular'}]}
 					placeholderTextColor="#888888"
 					editable={editable}       
                     textContentType={textContentType}
@@ -61,7 +60,8 @@ const styles = StyleSheet.create({
     input: {
         flex: 1,
         marginLeft: 5,
-        fontSize: 16
+        fontSize: 16,
+        paddingVertical: 0
     },
     errorMessage: {
         fontSize: 14,

+ 4 - 3
package-lock.json

@@ -30,6 +30,7 @@
         "expo-device": "~8.0.8",
         "expo-env": "^1.1.1",
         "expo-file-system": "~19.0.14",
+        "expo-font": "~14.0.9",
         "expo-image-picker": "~17.0.8",
         "expo-linking": "~8.0.8",
         "expo-location": "~19.0.7",
@@ -5738,9 +5739,9 @@
       }
     },
     "node_modules/expo-font": {
-      "version": "14.0.8",
-      "resolved": "https://registry.npmjs.org/expo-font/-/expo-font-14.0.8.tgz",
-      "integrity": "sha512-bTUHaJWRZ7ywP8dg3f+wfOwv6RwMV3mWT2CDUIhsK70GjNGlCtiWOCoHsA5Od/esPaVxqc37cCBvQGQRFStRlA==",
+      "version": "14.0.9",
+      "resolved": "https://registry.npmjs.org/expo-font/-/expo-font-14.0.9.tgz",
+      "integrity": "sha512-xCoQbR/36qqB6tew/LQ6GWICpaBmHLhg/Loix5Rku/0ZtNaXMJv08M9o1AcrdiGTn/Xf/BnLu6DgS45cWQEHZg==",
       "license": "MIT",
       "dependencies": {
         "fontfaceobserver": "^2.1.0"

+ 1 - 0
package.json

@@ -32,6 +32,7 @@
     "expo-device": "~8.0.8",
     "expo-env": "^1.1.1",
     "expo-file-system": "~19.0.14",
+    "expo-font": "~14.0.9",
     "expo-image-picker": "~17.0.8",
     "expo-linking": "~8.0.8",
     "expo-location": "~19.0.7",