From dca9a8daf5b633cd67104c37b5b42d886b10f89f Mon Sep 17 00:00:00 2001
From: "2206069183@qq.com" <2206069183@qq.com>
Date: Sat, 11 May 2024 15:19:45 +0800
Subject: [PATCH 1/2] =?UTF-8?q?[Issues:=20#I9OGSI]=20=E4=BF=AE=E6=94=B9rea?=
=?UTF-8?q?ct-native-drawer-layout-polyfill=E6=8C=87=E5=AF=BC=E6=96=87?=
=?UTF-8?q?=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/react-native-drawer-layout-polyfill.md | 26 ++++++++++----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/zh-cn/react-native-drawer-layout-polyfill.md b/zh-cn/react-native-drawer-layout-polyfill.md
index 0f77c8c2..56db0e4c 100644
--- a/zh-cn/react-native-drawer-layout-polyfill.md
+++ b/zh-cn/react-native-drawer-layout-polyfill.md
@@ -154,6 +154,19 @@ const App = () => {
弹框状态切换触发:{drawerStateChangedOutput}
+ onChangeText(text)}
+ value={value}
+ />
+
+
+
+
+
+
+
+
+> [!TIP] [Github 地址](https://github.com/zloirock/core-js)
+
+## 安装与使用
+
+进入到工程目录并输入以下命令:
+
+
+
+#### **npm**
+
+```bash
+npm install --save core-js@3.11.1
+```
+
+#### **yarn**
+
+```bash
+yarn add core-js@3.11.1
+```
+
+
+
+下面的代码展示了这个库的基本使用场景:
+
+```tsx
+import 'core-js'
+import {useState} from 'react'
+import { View,StyleSheet,Button,Text,ScrollView,TextInput } from 'react-native'
+
+const Babel = ()=>{
+ let [objText1,setobjText1] = useState('')
+ let [objText2,setobjText2] = useState('')
+
+ // Object
+ const assigns = ()=>{
+ let temp = {a:1,b:2}
+ setobjText1('Object.assign:'+JSON.stringify(temp)+JSON.stringify({c:3,d:4}))
+ temp = Object.assign(temp,{c:3,d:4})
+ setobjText2(JSON.stringify(temp))
+ }
+ const setPrototypeOf = ()=>{
+ function Parent(){}
+ function Child(){}
+ Object.setPrototypeOf(Child.prototype,Parent.prototype)
+ setobjText1('Object.setPrototypeOf:')
+ setobjText2((new Child() instanceof Parent?'true':'false') + (new Child() instanceof Child?'true':'false') )
+ }
+ const keys = ()=>{
+ let obj = {a:1,b:2,c:3}
+ setobjText1('Object.keys:'+JSON.stringify(obj))
+ setobjText2(JSON.stringify(Object.keys(obj)) )
+ }
+ const entries = ()=>{
+ let obj = {a:1,b:2,c:3}
+ setobjText1('Object.entries:'+JSON.stringify(obj))
+ setobjText2(JSON.stringify(Object.entries(obj)) )
+ }
+ const values = ()=>{
+ let obj = {a:1,b:2,c:3}
+ setobjText1('Object.values:'+JSON.stringify(obj))
+ setobjText2(JSON.stringify(Object.values(obj)) )
+ }
+ const getPrototypeOf = ()=>{
+ setobjText1('Object.getPrototypeOf:')
+ setobjText2(Object.getPrototypeOf('qwe')===String.prototype?'true':'false' )
+ }
+
+ //Array
+ let [arrText1,setArrText1] = useState('')
+ let [arrText2,setArrText2] = useState('')
+
+ const froms = ()=>{
+ setArrText1('Array.from:')
+ setArrText2(JSON.stringify(Array.from({length:3},()=>'from')) )
+ }
+ const ofs = ()=>{
+ setArrText1('Array.of:1,2,3,4,5')
+ setArrText2(JSON.stringify(Array.of(1,2,3,4,5)) )
+ }
+ let [arrMap,setarrMap] = useState([2,4])
+ const maps = ()=>{
+ setArrText1('Array.map:'+JSON.stringify(arrMap))
+ let temp = arrMap.map((item)=>item*item)
+ setArrText2(JSON.stringify(temp))
+ setarrMap(temp)
+ }
+ const finds = ()=>{
+ let temp = [1,2,3,4,5]
+ setArrText1('Array.find:[1,2,3,4,5] 2')
+ setArrText2(JSON.stringify(temp.find((value,key,arr)=>value>2 )) )
+ }
+ const findIndexs = ()=>{
+ let temp = [1,2,3,4,5]
+ setArrText1('Array.findIndex:[1,2,3,4,5] 1')
+ setArrText2(JSON.stringify(temp.findIndex((value,key,arr)=>value>1 )) )
+ }
+ let [arrReverse,setArrReverse] = useState([1,2,3,4,5])
+ const reverses = ()=>{
+ setArrText1('Array.reverse:'+JSON.stringify(arrReverse))
+ setArrText2(JSON.stringify(arrReverse.reverse()))
+ }
+ let [arrSplice,setArrSplice] = useState([1,2,3,4,5])
+ const splices = ()=>{
+ setArrText1('Array.splice:')
+ arrSplice.splice(0,2,3,4,5)
+ setArrText2(JSON.stringify(arrSplice))
+ }
+ const sorts = ()=>{
+ setArrText1('Array.sort:[1,5,2,7,4,9,3,8]')
+ setArrText2(JSON.stringify([1,5,2,7,4,9,3,8].sort()))
+ }
+ const reduces = ()=>{
+ let arr = [10,20,30]
+ let temp = arr.reduce((a,c)=>{
+ return a+c
+ },0)
+ setArrText1('Array.sort:'+arr)
+ setArrText2(JSON.stringify(temp))
+ }
+
+ // string
+ let [strText1,setStrText1] = useState('')
+ let [strText2,setStrText2] = useState('')
+ let str = 'test 1 2'
+ const includes = ()=>{
+ setStrText1('String.includes:')
+ setStrText2(JSON.stringify(str.includes('test')?'true':'false'))
+ }
+ const startsWiths = ()=>{
+ setStrText1('String.startsWith:')
+ setStrText2(JSON.stringify(str.startsWith('test')?'true':'false'))
+ }
+ const endsWiths = ()=>{
+ setStrText1('String.endsWith:')
+ setStrText2(JSON.stringify(str.endsWith('2')?'true':'false'))
+ }
+ const repeats = ()=>{
+ setStrText1('String.repeat:')
+ setStrText2(JSON.stringify(str.repeat(2)))
+ }
+ const padStarts = ()=>{
+ setStrText1('String.padStart:')
+ setStrText2(JSON.stringify(str.padStart(20,'12345')))
+ }
+ const padEnds = ()=>{
+ setStrText1('String.padEnd:')
+ setStrText2(JSON.stringify(str.padEnd(20,'12345')))
+ }
+ const fromCodePoints = ()=>{
+ setStrText1('String.fromCodePoint:97,134071,98')
+ setStrText2(JSON.stringify(String.fromCodePoint(97,134071,98)))
+ }
+ const codePointAts = ()=>{
+ setStrText1('String.codePointAt:𠮷')
+ setStrText2(JSON.stringify('𠮷'.codePointAt(0)))
+ }
+ const raws = ()=>{
+ setStrText1('String.raws: {raws:test},0,1,2')
+ setStrText2(JSON.stringify(String.raw({raw:'test'},0,1,2)))
+ }
+ const bolds = ()=>{
+ setStrText1('String.bold:')
+ setStrText2(JSON.stringify('test'.bold()))
+ }
+ const anchors = ()=>{
+ setStrText1('String.anchor:')
+ setStrText2(JSON.stringify('bar'.anchor('a"b')))
+ }
+ const links = ()=>{
+ setStrText1('String.link:')
+ setStrText2(JSON.stringify('baz'.link('https://example.com')))
+ }
+
+ // RegExp
+ let [regText1,setRegText1] = useState('')
+ let [regText2,setRegText2] = useState('')
+ const tests = ()=>{
+ setRegText1('RegExp.test:')
+ setRegText2(JSON.stringify(RegExp('.', 's').test('\n')))
+ }
+ const dotAlls = ()=>{
+ setRegText1('RegExp.dotAll:')
+ setRegText2(JSON.stringify(RegExp('.', 's').dotAll))
+ }
+ const execs = ()=>{
+ setRegText1('RegExp.exec:')
+ setRegText2(JSON.stringify(RegExp('foo:(?\\w+),bar:(?\\w+)').exec('foo:abc,bar:def')))
+ }
+ const flags = ()=>{
+ setRegText1('RegExp.flags:')
+ setRegText2(JSON.stringify(/foo/gim.flags))
+ }
+ const stickys = ()=>{
+ setRegText1('RegExp.stickys:')
+ setRegText2(JSON.stringify(RegExp('foo', 'y').sticky))
+ }
+ const replaces = ()=>{
+ setRegText1('RegExp.replace:')
+ setRegText2(JSON.stringify('foo:abc,bar:def'.replace(RegExp('foo:(?\\w+),bar:(?\\w+)'), '$,$')))
+ }
+ const prototypes = ()=>{
+ setRegText1('RegExp.prototype.toString.call:')
+ setRegText2(JSON.stringify(RegExp.prototype.toString.call({ source: 'foo', flags: 'bar' })))
+ }
+ const replaceAlls = ()=>{
+ setRegText1('RegExp.replaceAll:')
+ setRegText2(JSON.stringify('Test abc test test abc test.'.replaceAll('abc', 'foo')))
+ }
+
+
+ // Date
+ let [dateText1,setDateText1] = useState('')
+ let [dateText2,setDateText2] = useState('')
+ const dates = ()=>{
+ setDateText1('Date:')
+ setDateText2(JSON.stringify(new Date().toString()))
+ }
+ const nows = ()=>{
+ setDateText1('Date.now:')
+ setDateText2(JSON.stringify(Date.now()))
+ }
+ const parses = ()=>{
+ setDateText1('Date.parse:')
+ setDateText2(JSON.stringify(Date.parse('2024-04-01')))
+ }
+ const utcs = ()=>{
+ setDateText1('Date.UTC:')
+ setDateText2(JSON.stringify(Date.UTC(2023,4,1)))
+ }
+ const toISOStrings = ()=>{
+ let date = new Date()
+ setDateText1('Date.toISOString:')
+ setDateText2(JSON.stringify(date.toISOString()))
+ }
+ const toJSONs = ()=>{
+ let date = new Date()
+ setDateText1('Date.toJSON:')
+ setDateText2(JSON.stringify(date.toJSON()))
+ }
+ const toLocaleStrings = ()=>{
+ let date = new Date()
+ setDateText1('Date.toLocaleString:')
+ setDateText2(JSON.stringify(date.toLocaleString()))
+ }
+ const toLocaleDateStrings = ()=>{
+ let date = new Date()
+ setDateText1('Date.toLocaleDateString:')
+ setDateText2(JSON.stringify(date.toLocaleDateString()))
+ }
+ const toLocaleTimeStrings = ()=>{
+ let date = new Date()
+ setDateText1('Date.toLocaleTimeString:')
+ setDateText2(JSON.stringify(date.toLocaleTimeString()))
+ }
+ const valueOfs = ()=>{
+ let date = new Date()
+ setDateText1('Date.valueOf:')
+ setDateText2(JSON.stringify(date.valueOf()))
+ }
+ const getTimes = ()=>{
+ let date = new Date()
+ setDateText1('Date.getTime:')
+ setDateText2(JSON.stringify(date.getTime()))
+ }
+ const toDateStrings = ()=>{
+ let date = new Date()
+ setDateText1('Date.toDateString:')
+ setDateText2(JSON.stringify(date.toDateString()))
+ }
+ const toTimeStrings = ()=>{
+ let date = new Date()
+ setDateText1('Date.toTimeString:')
+ setDateText2(JSON.stringify(date.toTimeString()))
+ }
+ const getDates = ()=>{
+ let date = new Date()
+ setDateText1('Date.getDate:')
+ setDateText2(JSON.stringify(date.getDate()))
+ }
+ const getDays = ()=>{
+ let date = new Date()
+ setDateText1('Date.getDay:')
+ setDateText2(JSON.stringify(date.getDay()))
+ }
+ const getFullYears = ()=>{
+ let date = new Date()
+ setDateText1('Date.getFullYear:')
+ setDateText2(JSON.stringify(date.getFullYear()))
+ }
+ const getHours = ()=>{
+ let date = new Date()
+ setDateText1('Date.getHours:')
+ setDateText2(JSON.stringify(date.getHours()))
+ }
+ const getMilliseconds = ()=>{
+ let date = new Date()
+ setDateText1('Date.getMilliseconds:')
+ setDateText2(JSON.stringify(date.getMilliseconds()))
+ }
+ const getMinutes = ()=>{
+ let date = new Date()
+ setDateText1('Date.getMinutes :')
+ setDateText2(JSON.stringify(date.getMinutes()))
+ }
+ const getMonths = ()=>{
+ let date = new Date()
+ setDateText1('Date.getMonth :')
+ setDateText2(JSON.stringify(date.getMonth()))
+ }
+ const getSeconds = ()=>{
+ let date = new Date()
+ setDateText1('Date.getSeconds :')
+ setDateText2(JSON.stringify(date.getSeconds()))
+ }
+ const getTimezoneOffsets = ()=>{
+ let date = new Date()
+ setDateText1('Date.getTimezoneOffset :')
+ setDateText2(JSON.stringify(date.getTimezoneOffset()))
+ }
+
+
+
+ return (
+
+
+
+ Object
+
+
+
+
+
+
+
+
+
+ {objText1}
+ {objText2}
+
+
+
+ Array
+
+
+
+
+
+
+
+
+
+
+
+
+ {arrText1}
+ {arrText2}
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {strText1}
+ {strText2}
+
+
+
+ RegExp
+
+
+
+
+
+
+
+
+
+
+
+ {regText1}
+ {regText2}
+
+
+
+ Date
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {dateText1}
+ {dateText2}
+
+
+ )
+
+
+}
+
+const styles = StyleSheet.create({
+ container:{
+ width: '100%',
+ height: '100%'
+ },
+ text:{
+ width: '100%',
+ height: 30,
+ backgroundColor: '#eee',
+ marginTop: 5,
+ fontSize: 16,
+ lineHeight: 30,
+ textAlign: 'center',
+ numberOfLines: 1
+ },
+ flex:{
+ display: 'flex',
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ justifyContent:'space-around',
+ },
+ bord:{
+ borderWidth: 1,
+ minHeight: 30,
+ marginTop: 10,
+ fontSize: 16,
+ textAlign:'center'
+ }
+})
+
+export default Babel;
+```
+
+## 兼容性
+
+在以下版本验证通过
+
+1. RNOH:0.72.20; SDK:HarmonyOS NEXT Developer Preview2; IDE:DevEco Studio 5.0.3.200; ROM:205.0.0.18;
+
+## 属性
+
+详情见[react-native-drawer-layout-polyfill](https://reactnative.dev/docs/drawerlayoutandroid)
+
+| Name | Description | Type | Required | Platform | HarmonyOS Support | note |
+| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | ----------- | ----------------- | ------------------------------------------------------ |
+| renderNavigationView | The navigation view that will be rendered to the side of the screen and can be pulled in. | function | YES | Android IOS | YES | |
+| drawerPosition | Specifies the side of the screen from which the drawer will slide in. By default it is set to left. enum('left', 'right') | string | NO | Android IOS | YES | |
+| drawerWidth | Specifies the width of the drawer, more precisely the width of the view that be pulled in from the edge of the window. | number | NO | Android IOS | YES | |
+| keyboardDismissMode | Determines whether the keyboard gets dismissed in response to a drag. 'none' (the default), drags do not dismiss the keyboard. 'on-drag', the keyboard is dismissed when a drag begins. | string | NO | Android IOS | YES | |
+| drawerLockMode | Specifies the lock mode of the drawer. The drawer can be locked in 3 states: unlocked (default), meaning that the drawer will respond (open/close) to touch gestures. locked-closed, meaning that the drawer will stay closed and not respond to gestures. locked-open, meaning that the drawer will stay opened and not respond to gestures. The drawer may still be opened and closed programmatically (openDrawer/closeDrawer). | string | NO | Android IOS | YES | |
+| drawerBackgroundColor | Specifies the background color of the drawer. The default value is white. If you want to set the opacity of the drawer, use rgba. | string | NO | Android IOS | YES | |
+| statusBarBackgroundColor | Make the drawer take the entire screen and draw the background of the status bar to allow it to open over the status bar. It will only have an effect on API 21+. IOS and harmony are not supported. | string | NO | Android | NO | The original library only does the function of Android |
+| onDrawerOpen | Function called whenever the navigation view has been opened. | function | NO | Android IOS | YES | |
+| onDrawerClose | Function called whenever the navigation view has been closed. | function | NO | Android IOS | YES | |
+| onDrawerSlide | Function called whenever there is an interaction with the navigation view. | function | NO | Android IOS | YES | |
+| onDrawerStateChanged | Function called when the drawer state has changed. The drawer can be in 3 states: idle, meaning there is no interaction with the navigation view happening at the time | function | NO | Android IOS | YES | |
+
+## 方法
+
+| Name | Description | Required | Platform | HarmonyOS Support |
+| ----------- | ------------------ | -------- | ----------- | ----------------- |
+| openDrawer | Closes the drawer. | NO | Android IOS | YES |
+| closeDrawer | Opens the drawer. | NO | Android IOS | YES |
+
+## 遗留问题
+
+## 其他
--
Gitee