示例参考:rnLog(info: string) { console.log("ReactNative.log: " + info) console.log("xxx", getContext(this).cacheDir) TextPickerDialog.show({ range: ['apple1', 'orange2', 'peach3', 'grape4', 'banana5'], selected: 0, disappearTextStyle: { color: Color.Red, font: { size: 15, weight: FontWeight.Lighter } }, textStyle: { color: Color.Black, font: { size: 20, weight: FontWeight.Normal } }, selectedTextStyle: { color: Color.Blue, font: { size: 30, weight: FontWeight.Bolder } }, onAccept: (value: TextPickerResult) => { // 设置select为按下确定按钮时候的选中项index,这样当弹窗再次弹出时显示选中的是上一次确定的选项 //this.select = value.index //console.log(this.select + '') // 点击确定后,被选到的文本数据展示到页面 //this.v = value.value as string console.info("TextPickerDialog:onAccept()" + JSON.stringify(value)) }, onCancel: () => { console.info("TextPickerDialog:onCancel()") }, onChange: (value: TextPickerResult) => { console.info("TextPickerDialog:onChange()" + JSON.stringify(value)) }, onDidAppear: () => { console.info("TextPickerDialog:onDidAppear()") }, onDidDisappear: () => { console.info("TextPickerDialog:onDidDisappear()") }, onWillAppear: () => { console.info("TextPickerDialog:onWillAppear()") }, onWillDisappear: () => { console.info("TextPickerDialog:onWillDisappear()") } }) }在真机上测试可以打开TextPickerDialog弹窗,并且也打印了console.log(“xxx”, getContext(this).cacheDir)的路径。
示例参考:
在真机上测试可以打开TextPickerDialog弹窗,并且也打印了console.log(“xxx”, getContext(this).cacheDir)的路径。