From b4cf5f0b4eeca17d4ec16e4db1ee20b97000e653 Mon Sep 17 00:00:00 2001 From: Eden2016 Date: Fri, 17 Jan 2020 14:31:35 -0500 Subject: [PATCH 1/2] working on iOS --- app/widgets/Select.js | 68 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/app/widgets/Select.js b/app/widgets/Select.js index 65533381a..23c33a1df 100644 --- a/app/widgets/Select.js +++ b/app/widgets/Select.js @@ -1,17 +1,18 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Button, Text, Container, ListItem, Left, Right, Icon } from 'native-base'; +import { Text, Container, ListItem, Left, Right, Icon } from 'native-base'; import { Picker, Modal, StyleSheet, View } from 'react-native'; import { colors } from '../theme'; const styles = StyleSheet.create({ paddingContent: { - padding: 20, - flexGrow: 1, - }, - datePickerContainer: { - flexGrow: 1, - justifyContent: 'center', + position: 'absolute', + bottom: 0, + width: '100%', + height: '40%', + borderTopWidth: 2, + borderTopColor: colors.grey, + justifyContent: 'flex-start', }, label: { fontSize: 13, @@ -24,6 +25,13 @@ export class Select extends React.Component { modalVisible: false, }; + + componentDidUpdate(prevProps) { + if (prevProps.value !== this.props.value) { + this.setState({ modalVisible: false }); + } + } + setModalVisible(visible) { this.setState({ modalVisible: visible }); } @@ -56,38 +64,28 @@ export class Select extends React.Component { - - - { - config.itemList.map((item, index) => ( - - )) - } - - - + + { + config.itemList.map((item, index) => ( + + )) + } + From 26f2ad18d1914a6faf3ab6c0ca9d557de46a9a17 Mon Sep 17 00:00:00 2001 From: Eden2016 Date: Fri, 17 Jan 2020 15:31:21 -0500 Subject: [PATCH 2/2] Cross platform solution for Select component without modal --- CHANGELOG.md | 3 +++ android/app/build.gradle | 4 ++-- app/widgets/Select.js | 38 ++++++++++++++++---------------------- ios/MDCApp/Info.plist | 4 ++-- package.json | 2 +- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ca28c2cc..f0cc005ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ======= +## [0.9.16] - 2020-01-17 +- :recycle: Cross platform refactor for Select Component without Modal + ## [0.9.13] - 2019-01-08 - :bug: Fix DatePickerIOS doesn't show on Dark Mode for iOS 13.3 diff --git a/android/app/build.gradle b/android/app/build.gradle index 537ef1e1d..d7e324030 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -101,8 +101,8 @@ android { applicationId "lab.childmindinstitute.data" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 106 - versionName "0.9.13" + versionCode 109 + versionName "0.9.16" ndk { abiFilters "arm64-v8a", "x86_64", "armeabi-v7a", "x86" } diff --git a/app/widgets/Select.js b/app/widgets/Select.js index 23c33a1df..d33cf3c6c 100644 --- a/app/widgets/Select.js +++ b/app/widgets/Select.js @@ -6,10 +6,7 @@ import { colors } from '../theme'; const styles = StyleSheet.create({ paddingContent: { - position: 'absolute', - bottom: 0, - width: '100%', - height: '40%', + flex: 1, borderTopWidth: 2, borderTopColor: colors.grey, justifyContent: 'flex-start', @@ -50,23 +47,7 @@ export class Select extends React.Component { const selectedItem = config.itemList.find(item => item.value === value); return ( - { - this.setModalVisible(true); - }} - > - - {selectedItem ? selectedItem.name.en : 'Select one'} - - - - - - + {this.state.modalVisible ? ( - + ) : ( + { + this.setModalVisible(true); + }} + > + + {selectedItem ? selectedItem.name.en : 'Select one'} + + + + + + )} ); } diff --git a/ios/MDCApp/Info.plist b/ios/MDCApp/Info.plist index de730018f..1b3c4cecf 100644 --- a/ios/MDCApp/Info.plist +++ b/ios/MDCApp/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.13 + 0.9.16 CFBundleSignature ???? CFBundleVersion - 106 + 109 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/package.json b/package.json index 0dde7d397..cc3eb88c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "MindLogger", - "version": "0.9.13", + "version": "0.9.16", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start",