From e018499ef07fad8b3dcf5a87bf121a44a74dfca8 Mon Sep 17 00:00:00 2001 From: chenwenhui133 <2984202073@qq.com> Date: Wed, 18 Jun 2025 15:15:36 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20[Issues:=20#ICG2DA]=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9react-native--sqlite-storage=E5=92=8Creact-native-syan?= =?UTF-8?q?-image-picker=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9redux-toolkit=E5=BA=93=E4=B8=AD=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E7=9A=84required=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- en/js/redux-toolkit.md | 94 ++++++++++++------------- en/react-native-sqlite-storage.md | 67 ++++++++++-------- en/react-native-syan-image-picker.md | 79 ++++++++++++++++++--- zh-cn/js/redux-toolkit.md | 92 ++++++++++++------------ zh-cn/react-native-sqlite-storage.md | 67 ++++++++++-------- zh-cn/react-native-syan-image-picker.md | 79 ++++++++++++++++++--- 6 files changed, 313 insertions(+), 165 deletions(-) diff --git a/en/js/redux-toolkit.md b/en/js/redux-toolkit.md index 77b4a7be..b957542a 100644 --- a/en/js/redux-toolkit.md +++ b/en/js/redux-toolkit.md @@ -18,7 +18,7 @@ > [!TIP] This library depends on the react-redux library. For details about how to install this library, see [react-redux documentation](./react-redux.md). -Find the matching version information in the release address of a third-party library and download an applicable .tgz package: [redux-toolkit Releases](redux-toolkit Releases](https://github.com/reduxjs/redux-toolkit/releases). +Find the matching version information in the release address of a third-party library and download an applicable .tgz package: [redux-toolkit Releases](https://github.com/reduxjs/redux-toolkit/releases). @@ -164,58 +164,58 @@ This document is verified based on the following versions: | Name | Description | Type | Required | Platform | HarmonyOS Support | | ------------------------ | ------------------------------------------------------------ | -------- | -------- | -------- | ----------------- | -| configureStore | Method used to create **store**. | Function | yes | All | yes | -| reducer | Parameter of **configureStore**. | Object | yes | All | yes | -| middleware | Parameter of **configureStore**, which is used to store the array of middleware. | Array | yes | All | yes | -| devTools | Parameter of **configureStore**, which is used for browser debugging. | Boolean | yes | Web | no | -| preloadedState | Parameter of **configureStore**, which is used to specify the default value of **state**. | Object | yes | All | yes | -| enhancers | Parameter of **configureStore**, which is used to customize the enhancer array. | Array | yes | All | yes | -| getDefaultMiddleware | Method used to obtain the default middleware list. | Function | yes | All | yes | -| immutableCheck | Property of the object parameters in **getDefaultMiddleware**. | Boolean | yes | All | yes | -| serializableCheck | Property of the object parameters in **getDefaultMiddleware**. | Boolean | yes | All | yes | -| actionCreatorCheck | Property of the object parameters in **getDefaultMiddleware**. | Boolean | yes | All | yes | -| createListenerMiddleware | Method used to create a listener for the middleware. | Function | yes | All | yes | -| middleware | Property of **createListenerMiddleware**, which indicates the middleware list. | Array | yes | All | yes | -| startListening | Property of **createListenerMiddleware**, which is used to start a listening. | Function | yes | All | yes | -| stopListening | Property of **createListenerMiddleware**, which is used to stop a listening. | Function | yes | All | yes | -| clearListeners | Property of **createListenerMiddleware**, which is used to clear all listening events. | Function | yes | All | yes | -| addListener | Property of **createListenerMiddleware**, which is used to add a listener. | Function | yes | All | yes | -| removeListener | Property of **createListenerMiddleware**, which is used to remove a listener. | Function | yes | All | yes | -| clearAllListeners | Property of **createListenerMiddleware**, which is used to clear all listeners. | Function | yes | All | yes | -| createDynamicMiddleware | Method used to create a middleware. | Function | yes | All | yes | -| getDefaultEnhancers | Method used to obtain the default enhancers. | Function | yes | All | yes | -| createReducer | Method used to create a reducer. | Function | yes | All | yes | -| addCase | Method for the **createReducer** function to return the object parameters, which is used to add an action. | Function | yes | All | yes | -| addMatcher | Method for the **createReducer** function to return the object parameters, which is used to add a matcher. | Function | yes | All | yes | -| addDefaultCase | Method for the **createReducer** function to return the object parameters, which is used to add a default action. | Function | yes | All | yes | -| createAction | Method used to create an action. | Function | yes | All | yes | -| createSlice | Method used to create a slice. | Function | yes | All | yes | -| name | Property of **createSlice**, which indicates the name of **store**. | String | yes | All | yes | -| initialState | Property of **createSlice**, which indicates the default value of **store**. | object | yes | All | yes | -| reducers | Property of **createSlice**, which is a **reducers** object. | Object | yes | All | yes | -| extraReducers | Property of **createSlice**, which is an additional **reducers** object. | Object | yes | All | yes | -| createAsyncThunk | Method used to create an asynchronous action. | Function | yes | All | yes | -| createEntityAdapter | Method used to create an entity adapter. | Function | yes | All | yes | -| selectId | Property of **createEntityAdapter**, which indicates a unique ID. | String | yes | All | yes | -| sortComparer | Property of **createEntityAdapter**, which indicates the sorting method. | Function | yes | All | yes | -| getInitialState | Property of **createEntityAdapter**, which indicates the default state. | Object | yes | All | yes | -| combineSlices | Method used to combine two slices. | Function | yes | All | yes | -| createSelector | Method used to create a selector. | Function | yes | All | yes | +| configureStore | Method used to create **store**. | Function | NO | All | yes | +| reducer | Parameter of **configureStore**. | Object | NO | All | yes | +| middleware | Parameter of **configureStore**, which is used to store the array of middleware. | Array | NO | All | yes | +| devTools | Parameter of **configureStore**, which is used for browser debugging. | Boolean | NO | Web | no | +| preloadedState | Parameter of **configureStore**, which is used to specify the default value of **state**. | Object | NO | All | yes | +| enhancers | Parameter of **configureStore**, which is used to customize the enhancer array. | Array | NO | All | yes | +| getDefaultMiddleware | Method used to obtain the default middleware list. | Function | NO | All | yes | +| immutableCheck | Property of the object parameters in **getDefaultMiddleware**. | Boolean | NO | All | yes | +| serializableCheck | Property of the object parameters in **getDefaultMiddleware**. | Boolean | NO | All | yes | +| actionCreatorCheck | Property of the object parameters in **getDefaultMiddleware**. | Boolean | NO | All | yes | +| createListenerMiddleware | Method used to create a listener for the middleware. | Function | NO | All | yes | +| middleware | Property of **createListenerMiddleware**, which indicates the middleware list. | Array | NO | All | yes | +| startListening | Property of **createListenerMiddleware**, which is used to start a listening. | Function | NO | All | yes | +| stopListening | Property of **createListenerMiddleware**, which is used to stop a listening. | Function | NO | All | yes | +| clearListeners | Property of **createListenerMiddleware**, which is used to clear all listening events. | Function | NO | All | yes | +| addListener | Property of **createListenerMiddleware**, which is used to add a listener. | Function | NO | All | yes | +| removeListener | Property of **createListenerMiddleware**, which is used to remove a listener. | Function | NO | All | yes | +| clearAllListeners | Property of **createListenerMiddleware**, which is used to clear all listeners. | Function | NO | All | yes | +| createDynamicMiddleware | Method used to create a middleware. | Function | NO | All | yes | +| getDefaultEnhancers | Method used to obtain the default enhancers. | Function | NO | All | yes | +| createReducer | Method used to create a reducer. | Function | NO | All | yes | +| addCase | Method for the **createReducer** function to return the object parameters, which is used to add an action. | Function | NO | All | yes | +| addMatcher | Method for the **createReducer** function to return the object parameters, which is used to add a matcher. | Function | NO | All | yes | +| addDefaultCase | Method for the **createReducer** function to return the object parameters, which is used to add a default action. | Function | NO | All | yes | +| createAction | Method used to create an action. | Function | NO | All | yes | +| createSlice | Method used to create a slice. | Function | NO | All | yes | +| name | Property of **createSlice**, which indicates the name of **store**. | String | NO | All | yes | +| initialState | Property of **createSlice**, which indicates the default value of **store**. | object | NO | All | yes | +| reducers | Property of **createSlice**, which is a **reducers** object. | Object | NO | All | yes | +| extraReducers | Property of **createSlice**, which is an additional **reducers** object. | Object | NO | All | yes | +| createAsyncThunk | Method used to create an asynchronous action. | Function | NO | All | yes | +| createEntityAdapter | Method used to create an entity adapter. | Function | NO | All | yes | +| selectId | Property of **createEntityAdapter**, which indicates a unique ID. | String | NO | All | yes | +| sortComparer | Property of **createEntityAdapter**, which indicates the sorting method. | Function | NO | All | yes | +| getInitialState | Property of **createEntityAdapter**, which indicates the default state. | Object | NO | All | yes | +| combineSlices | Method used to combine two slices. | Function | NO | All | yes | +| createSelector | Method used to create a selector. | Function | NO | All | yes | | | | | | | | ## Utilities | Name | Description | Type | Required | Platform | HarmonyOS Support | | ------------------- | --------------------------------------------------------- | -------- | -------- | -------- | ----------------- | -| isAllOf | Checks whether all actions are passed. | Function | yes | All | yes | -| isAnyOf | Checks whether an action is passed. | Function | yes | All | yes | -| isAsyncThunkAction | Checks whether an action is asynchronous. | Function | yes | All | yes | -| isPending | Checks whether an action is pending. | Function | yes | All | yes | -| isRejected | Checks whether an action is fulfilled. | Function | yes | All | yes | -| isFulfilled | Checks whether an action is rejected. | Function | yes | All | yes | -| isRejectedWithValue | Checks whether an action is rejected with a return value. | Function | yes | All | yes | -| nanoid | Method used to generate a random string. | Function | yes | All | yes | -| miniSerializeError | Method used to display error information. | Function | yes | All | yes | +| isAllOf | Checks whether all actions are passed. | Function | NO | All | yes | +| isAnyOf | Checks whether an action is passed. | Function | NO | All | yes | +| isAsyncThunkAction | Checks whether an action is asynchronous. | Function | NO | All | yes | +| isPending | Checks whether an action is pending. | Function | NO | All | yes | +| isRejected | Checks whether an action is fulfilled. | Function | NO | All | yes | +| isFulfilled | Checks whether an action is rejected. | Function | NO | All | yes | +| isRejectedWithValue | Checks whether an action is rejected with a return value. | Function | NO | All | yes | +| nanoid | Method used to generate a random string. | Function | NO | All | yes | +| miniSerializeError | Method used to display error information. | Function | NO | All | yes | ## Known Issues diff --git a/en/react-native-sqlite-storage.md b/en/react-native-sqlite-storage.md index db3e1148..73859e53 100644 --- a/en/react-native-sqlite-storage.md +++ b/en/react-native-sqlite-storage.md @@ -55,23 +55,44 @@ const database_name = 'Test.db'; const database_version = '1.0'; const database_displayname = 'SQLite Test Database'; const database_size = 200000; -let db; -const Item = ({title}) => ( - - {title} - -); -class SQLiteDemo extends Component { - constructor() { - super(); +let db: any; +const Item = (props: any) => { + const { title } = props; + return( + + {title} + + ) +}; + +interface SQLiteDemo { + progress: string[] +} + +interface State { + progress: string[] +} + +interface rowsType { + item: any, + length: number +} + +interface ResultType { + rows: rowsType +} + +class SQLiteDemo extends Component<{}, State> { + constructor(props: any) { + super(props); this.progress = []; this.state = { progress: [], }; } - updateProgress = (text, resetState) => { - let progress = []; + updateProgress = (text: string, resetState?: boolean) => { + let progress: string[] = []; if (!resetState) { progress = [...this.progress]; } @@ -86,7 +107,7 @@ class SQLiteDemo extends Component { this.closeDatabase(); }; - errorCB = err => { + errorCB = (err: any) => { console.log('error: ', err); this.updateProgress('Error: ' + (err.message || err)); return false; @@ -110,7 +131,7 @@ class SQLiteDemo extends Component { }; // eslint-disable-next-line no-shadow - populateDatabase = db => { + populateDatabase = (db: any) => { this.updateProgress('Database integrity check'); db.executeSql( 'SELECT 1 FROM Version LIMIT 1', @@ -121,7 +142,7 @@ class SQLiteDemo extends Component { this.updateProgress('Processing completed'); }); }, - error => { + (error: any) => { console.log('received version error:', error); this.updateProgress('Database not yet ready ... populating data'); db.transaction(this.populateDB, this.errorCB, () => { @@ -136,7 +157,7 @@ class SQLiteDemo extends Component { ); }; - populateDB = tx => { + populateDB = (tx: any) => { this.updateProgress('Executing DROP stmts'); tx.executeSql('DROP TABLE IF EXISTS Employees;'); @@ -258,7 +279,7 @@ class SQLiteDemo extends Component { console.log('all config SQL done'); }; - queryEmployees = async tx => { + queryEmployees = async (tx: any) => { console.log('Executing JSON1 queries...'); // 1. JSON_OBJECT @@ -359,7 +380,7 @@ class SQLiteDemo extends Component { ); }; - querySuccess = (tx, results) => { + querySuccess = (tx: any, results: ResultType) => { this.updateProgress('Query completed'); var len = results.rows.length; for (let i = 0; i < len; i++) { @@ -419,16 +440,6 @@ class SQLiteDemo extends Component { } - renderProgressEntry = entry => { - return ( - - - {entry} - - - ); - }; - render = () => { return ( @@ -449,7 +460,7 @@ class SQLiteDemo extends Component { } - keyExtractor={item => item.i} + keyExtractor={(item: any )=> item.i} /> ); diff --git a/en/react-native-syan-image-picker.md b/en/react-native-syan-image-picker.md index 9adcb090..654a9a7e 100644 --- a/en/react-native-syan-image-picker.md +++ b/en/react-native-syan-image-picker.md @@ -48,21 +48,36 @@ Create an imagePicker.js file import React from "react"; import { StyleSheet, - Text, View, Image, ScrollView, - TouchableOpacity, Dimensions, Button } from 'react-native'; -import SYImagePicker from "react-native-syan-image-picker"; +import RNCVideo from 'react-native-video'; +import SYImagePicker, { SelectedPhoto } from "react-native-syan-image-picker"; -export default class App extends React.Component { - constructor(props) { +const {width} = Dimensions.get('window'); + +interface State { + photos: SelectedPhoto[] + video: SelectedPhoto[] +} + +interface ItemType { + height: number, + original_uri: string, + size: number, + width: number, + uri: string, +} + +export default class App extends React.Component<{}, State> { + constructor(props: any) { super(props); this.state = { photos: [], + video: [], }; } /** @@ -72,9 +87,9 @@ export default class App extends React.Component { SYImagePicker.showImagePicker( { isCamera: true, - imageCount: 1, + imageCount: 1, // Cropping can be enabled only when **imageCount** is set to **1**. quality: 10, - compress: true, + compress: true, // Enable compression. enableBase64: true, isCrop: true, }, (err, photos) => { @@ -231,8 +246,10 @@ export default class App extends React.Component { }; render() { + const { photos } = this.state; + const { video } = this.state; return ( - +