feat: fix new user null bug and text input bug (#31)
This commit is contained in:
parent
4fef2a2e30
commit
ea4f542b0f
17
App.js
17
App.js
|
@ -12,7 +12,9 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import * as React from "react";
|
||||
import React from "react";
|
||||
import {Lato_700Bold, useFonts} from "@expo-google-fonts/lato";
|
||||
import {Roboto_500Medium} from "@expo-google-fonts/roboto";
|
||||
import {NavigationContainer} from "@react-navigation/native";
|
||||
import {PaperProvider} from "react-native-paper";
|
||||
import {SafeAreaView, Text} from "react-native";
|
||||
|
@ -29,6 +31,11 @@ import migrations from "./drizzle/migrations";
|
|||
|
||||
const App = () => {
|
||||
const {success, error} = useMigrations(db, migrations);
|
||||
const [fontsLoaded] = useFonts({
|
||||
Lato_700Bold,
|
||||
Roboto_500Medium,
|
||||
});
|
||||
|
||||
const {NotificationsProvider} = createNotifications({
|
||||
duration: 800,
|
||||
notificationPosition: "top",
|
||||
|
@ -53,13 +60,14 @@ const App = () => {
|
|||
);
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
if (!success || !fontsLoaded) {
|
||||
return (
|
||||
<SafeAreaView style={{flex: 1, justifyContent: "center", alignItems: "center"}}>
|
||||
<ContentLoader
|
||||
speed={2}
|
||||
width={400}
|
||||
width={300}
|
||||
height={150}
|
||||
viewBox="0 0 400 150"
|
||||
viewBox="0 0 300 150"
|
||||
backgroundColor="#f3f3f3"
|
||||
foregroundColor="#ecebeb"
|
||||
>
|
||||
|
@ -72,6 +80,7 @@ const App = () => {
|
|||
<Circle cx="10" cy="110" r="8" />
|
||||
<Rect x="25" y="105" rx="5" ry="5" width="220" height="10" />
|
||||
</ContentLoader>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ function CasdoorLoginPage({onWebviewClose, initialMethod}) {
|
|||
<EnterCasdoorSdkConfig
|
||||
onClose={() => handleLogin(initialMethod)}
|
||||
onWebviewClose={onWebviewClose}
|
||||
usePortal={false}
|
||||
/>
|
||||
),
|
||||
scanner: (
|
||||
|
|
|
@ -19,7 +19,7 @@ import {useNotifications} from "react-native-notificated";
|
|||
import PropTypes from "prop-types";
|
||||
import useStore from "./useStorage";
|
||||
|
||||
function EnterCasdoorSdkConfig({onClose, onWebviewClose}) {
|
||||
function EnterCasdoorSdkConfig({onClose, onWebviewClose, usePortal = true}) {
|
||||
const {
|
||||
serverUrl,
|
||||
clientId,
|
||||
|
@ -52,8 +52,7 @@ function EnterCasdoorSdkConfig({onClose, onWebviewClose}) {
|
|||
onClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<Portal>
|
||||
const content = (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.content}>
|
||||
<Text style={styles.title}>Casdoor Configuration</Text>
|
||||
|
@ -111,13 +110,15 @@ function EnterCasdoorSdkConfig({onClose, onWebviewClose}) {
|
|||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</Portal>
|
||||
);
|
||||
|
||||
return usePortal ? <Portal>{content}</Portal> : content;
|
||||
}
|
||||
|
||||
EnterCasdoorSdkConfig.propTypes = {
|
||||
onClose: PropTypes.func.isRequired,
|
||||
onWebviewClose: PropTypes.func.isRequired,
|
||||
usePortal: PropTypes.bool,
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
@ -142,7 +143,7 @@ const styles = StyleSheet.create({
|
|||
title: {
|
||||
fontSize: 20,
|
||||
fontWeight: "bold",
|
||||
fontFamily: "Lato-Bold",
|
||||
fontFamily: "Lato_700Bold",
|
||||
color: "#212121",
|
||||
textAlign: "center",
|
||||
marginBottom: 16,
|
||||
|
|
|
@ -159,7 +159,7 @@ const styles = StyleSheet.create({
|
|||
fontSize: Math.max(24, width * 0.05),
|
||||
fontWeight: "bold",
|
||||
color: "#212121",
|
||||
fontFamily: "Lato-Bold",
|
||||
fontFamily: "Lato_700Bold",
|
||||
},
|
||||
buttonContainer: {
|
||||
borderRadius: 24,
|
||||
|
@ -179,7 +179,7 @@ const styles = StyleSheet.create({
|
|||
fontWeight: "600",
|
||||
marginLeft: 8,
|
||||
color: "#424242",
|
||||
fontFamily: "Roboto-Medium",
|
||||
fontFamily: "Roboto_500Medium",
|
||||
},
|
||||
menuContent: {
|
||||
backgroundColor: "#FAFAFA",
|
||||
|
|
5
api.js
5
api.js
|
@ -38,7 +38,10 @@ export const getMfaAccounts = async(serverUrl, owner, name, token, timeoutMs = T
|
|||
throw new Error(res.msg);
|
||||
}
|
||||
|
||||
return {updatedTime: res.data.updatedTime, mfaAccounts: res.data.mfaAccounts};
|
||||
return {
|
||||
updatedTime: res.data.updatedTime,
|
||||
mfaAccounts: res.data.mfaAccounts || [],
|
||||
};
|
||||
} catch (error) {
|
||||
if (error.name === "AbortError") {
|
||||
throw new Error("Request timed out");
|
||||
|
|
3
app.json
3
app.json
|
@ -50,7 +50,8 @@
|
|||
"photosPermission": "The app accesses your photos to add Totp account."
|
||||
}
|
||||
],
|
||||
"expo-asset"
|
||||
"expo-asset",
|
||||
"expo-font"
|
||||
],
|
||||
"owner": "casdoor"
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
"name": "casdoor-app",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@expo-google-fonts/lato": "^0.2.3",
|
||||
"@expo-google-fonts/roboto": "^0.2.3",
|
||||
"@expo/react-native-action-sheet": "^4.1.0",
|
||||
"@react-native-async-storage/async-storage": "1.23.1",
|
||||
"@react-native-community/masked-view": "^0.1.11",
|
||||
|
@ -19,13 +21,14 @@
|
|||
"casdoor-react-native-sdk": "1.1.0",
|
||||
"drizzle-orm": "^0.33.0",
|
||||
"eslint-plugin-import": "^2.28.1",
|
||||
"expo": "~51.0.37",
|
||||
"expo": "~51.0.38",
|
||||
"expo-asset": "~10.0.10",
|
||||
"expo-camera": "~15.0.16",
|
||||
"expo-crypto": "~13.0.2",
|
||||
"expo-dev-client": "~4.0.28",
|
||||
"expo-document-picker": "~12.0.2",
|
||||
"expo-drizzle-studio-plugin": "^0.0.2",
|
||||
"expo-font": "~12.0.10",
|
||||
"expo-image": "~1.13.0",
|
||||
"expo-image-picker": "~15.0.7",
|
||||
"expo-sqlite": "^14.0.6",
|
||||
|
@ -3112,6 +3115,18 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/@expo-google-fonts/lato": {
|
||||
"version": "0.2.3",
|
||||
"resolved": "https://registry.npmjs.com/@expo-google-fonts/lato/-/lato-0.2.3.tgz",
|
||||
"integrity": "sha512-X56FEZn2GNYtI2/UqyOps7TShuDwi/k9JKa7VzM0x2ywBOnhTtXGq2IsZyNPzT9KnQA/ID84F9yiMS8e3obu0g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@expo-google-fonts/roboto": {
|
||||
"version": "0.2.3",
|
||||
"resolved": "https://registry.npmjs.com/@expo-google-fonts/roboto/-/roboto-0.2.3.tgz",
|
||||
"integrity": "sha512-PF6S//ZYWeXfpYTwvY2oEe0d5RnqwR5KMsGjuTgg6y9p/CPK/IkWL+wsbkzjfd+Jck1Q1pRlWOoe5uz42sQFRg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@expo/bunyan": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.com/@expo/bunyan/-/bunyan-4.0.1.tgz",
|
||||
|
@ -11260,9 +11275,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/expo": {
|
||||
"version": "51.0.37",
|
||||
"resolved": "https://registry.npmjs.com/expo/-/expo-51.0.37.tgz",
|
||||
"integrity": "sha512-zMdfTiGNgNWG0HOOFA3zRreS94iQ7fDxxgEIR6wdQCbncTpbeYj+5mscTAlHE9JJ+oBkcNyJXrLSjE/YVbFERg==",
|
||||
"version": "51.0.38",
|
||||
"resolved": "https://registry.npmjs.com/expo/-/expo-51.0.38.tgz",
|
||||
"integrity": "sha512-/B9npFkOPmv6WMIhdjQXEY0Z9k/67UZIVkodW8JxGIXwKUZAGHL+z1R5hTtWimpIrvVhyHUFU3f8uhfEKYhHNQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.0",
|
||||
|
@ -11277,7 +11292,7 @@
|
|||
"expo-font": "~12.0.10",
|
||||
"expo-keep-awake": "~13.0.2",
|
||||
"expo-modules-autolinking": "1.11.3",
|
||||
"expo-modules-core": "1.12.25",
|
||||
"expo-modules-core": "1.12.26",
|
||||
"fbemitter": "^3.0.0",
|
||||
"whatwg-url-without-unicode": "8.0.0-3"
|
||||
},
|
||||
|
@ -11667,9 +11682,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/expo-modules-core": {
|
||||
"version": "1.12.25",
|
||||
"resolved": "https://registry.npmjs.com/expo-modules-core/-/expo-modules-core-1.12.25.tgz",
|
||||
"integrity": "sha512-HB2LS2LEM41Xq1bG+Jtzqm6XgPaa+mM9BAvCdX1lDGMQ9Ay9vMTL/GVEs2gpsINPofICopjBRwD+wftyCbVrzg==",
|
||||
"version": "1.12.26",
|
||||
"resolved": "https://registry.npmjs.com/expo-modules-core/-/expo-modules-core-1.12.26.tgz",
|
||||
"integrity": "sha512-y8yDWjOi+rQRdO+HY+LnUlz8qzHerUaw/LUjKPU/mX8PRXP4UUPEEp5fjAwBU44xjNmYSHWZDwet4IBBE+yQUA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"invariant": "^2.2.4"
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
"release": "npx -p semantic-release-expo -p semantic-release -p @semantic-release/git -p @semantic-release/changelog -p @semantic-release/exec semantic-release"
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo-google-fonts/lato": "^0.2.3",
|
||||
"@expo-google-fonts/roboto": "^0.2.3",
|
||||
"@expo/react-native-action-sheet": "^4.1.0",
|
||||
"@react-native-async-storage/async-storage": "1.23.1",
|
||||
"@react-native-community/masked-view": "^0.1.11",
|
||||
|
@ -21,13 +23,14 @@
|
|||
"casdoor-react-native-sdk": "1.1.0",
|
||||
"drizzle-orm": "^0.33.0",
|
||||
"eslint-plugin-import": "^2.28.1",
|
||||
"expo": "~51.0.37",
|
||||
"expo": "~51.0.38",
|
||||
"expo-asset": "~10.0.10",
|
||||
"expo-camera": "~15.0.16",
|
||||
"expo-crypto": "~13.0.2",
|
||||
"expo-dev-client": "~4.0.28",
|
||||
"expo-document-picker": "~12.0.2",
|
||||
"expo-drizzle-studio-plugin": "^0.0.2",
|
||||
"expo-font": "~12.0.10",
|
||||
"expo-image": "~1.13.0",
|
||||
"expo-image-picker": "~15.0.7",
|
||||
"expo-sqlite": "^14.0.6",
|
||||
|
|
Loading…
Reference in New Issue