Skip to content

Commit

Permalink
v8 release #344)
Browse files Browse the repository at this point in the history
* feat: Moved to @react-native-community pickers

BREAKING CHANGE

* Bump version

BREAKING CHANGE: bumping to 8.0.0

* docs: Added v8 info

* docs: Update README.md

* docs: Update README.md

* docs: Update README.md

* Update README.md

* docs: Update README.md

* fix: Fixed modal styling (#306)

* fix: Updated TypeScript definitions for v8.0.0 (#307)

* Updated dependencies

* Fix: Wrong version bump

* v8.0.1

* fix: Use getDate() instead of getDay()

* v8.0.2

* Type custom components in props as React.ComponentType / PropTypes.elementType (#314)

* v8.0.3

* fix: Rename onModalHide to onHide Modal prop to make onHide callback work on iOS (#316)

* Export TS interface

* v8.0.4

* Mentioned Expo instructions in the README.md

* feat: Added custom component types (#336)

* v8.0.5

* fix: Fix hiding header on IOS not working (#339)

* v8.0.6

* Set the library version to 8.x.x for Expo setup (#342)

It would probably makes things easier for people migrating from version 7.

Co-authored-by: Michiel De Mey <de.mey.michiel@gmail.com>
Co-authored-by: Christiaan van Bemmel <github@cvbemmel.nl>
Co-authored-by: Alexey Bulavka <bulavka.aleksey@gmail.com>
Co-authored-by: Simonas Gildutis <simonasgildutis@gmail.com>
Co-authored-by: Phillip-Cognativ <46981284+Phillip-Cognativ@users.noreply.github.com>
Co-authored-by: Victor Goya <goya.victor@gmail.com>
  • Loading branch information
7 people committed Jan 16, 2020
1 parent 01443a6 commit d894a83
Show file tree
Hide file tree
Showing 43 changed files with 4,100 additions and 7,930 deletions.
5 changes: 4 additions & 1 deletion .circleci/config.yml
Expand Up @@ -60,4 +60,7 @@ workflows:
- tests
filters:
branches:
only: master
only:
- master
- next
- next-major
2 changes: 1 addition & 1 deletion .eslintrc
@@ -1,3 +1,3 @@
{
"extends": ["plugin:react-app/recommended"]
"extends": ["plugin:react-app/recommended", "plugin:prettier/recommended"]
}
Binary file modified .github/images/datetimepicker-android.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/images/datetimepicker-ios.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -44,3 +44,6 @@ android/keystores/debug.keystore
.vscode
jsconfig.json
npm-debug.log.*

# yarn
yarn-error.log
198 changes: 79 additions & 119 deletions README.md

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions example/.buckconfig

This file was deleted.

69 changes: 0 additions & 69 deletions example/.flowconfig

This file was deleted.

3 changes: 3 additions & 0 deletions example/.gitignore
Expand Up @@ -54,3 +54,6 @@ buck-out/

# Bundle artifact
*.jsbundle

# CocoaPods
/ios/Pods/
1 change: 0 additions & 1 deletion example/.watchmanconfig

This file was deleted.

69 changes: 33 additions & 36 deletions example/App.js
@@ -1,50 +1,47 @@
import React, { Component } from "react";
import { Button, StyleSheet, Text, View } from "react-native";
import DateTimePicker from "react-native-modal-datetime-picker";

export default class DateTimePickerTester extends Component {
state = {
isDateTimePickerVisible: false,
selectedDate: ""
import React, { useState } from "react";
import { Button, StyleSheet, View } from "react-native";
import DateTimePickerModal from "react-native-modal-datetime-picker";

const App = () => {
const [pickerMode, setPickerMode] = useState(null);

const showDatePicker = () => {
setPickerMode("date");
};

showDateTimePicker = () => {
this.setState({ isDateTimePickerVisible: true });
const showTimePicker = () => {
setPickerMode("time");
};

hideDateTimePicker = () => {
this.setState({ isDateTimePickerVisible: false });
const hidePicker = () => {
setPickerMode(null);
};

handleDatePicked = date => {
this.setState({ selectedDate: date.toString() });
this.hideDateTimePicker();
const handleConfirm = date => {
console.warn("A date has been picked: ", date);
hidePicker();
};

render() {
const { isDateTimePickerVisible, selectedDate } = this.state;

return (
<View style={styles.container}>
<Button title="Show DatePicker" onPress={this.showDateTimePicker} />
<Text style={styles.text}>{selectedDate}</Text>
<DateTimePicker
isVisible={isDateTimePickerVisible}
onConfirm={this.handleDatePicked}
onCancel={this.hideDateTimePicker}
/>
</View>
);
}
}
return (
<View style={style.root}>
<Button title="Show Date Picker" onPress={showDatePicker} />
<Button title="Show Time Picker" onPress={showTimePicker} />
<DateTimePickerModal
isVisible={pickerMode !== null}
mode={pickerMode}
onConfirm={handleConfirm}
onCancel={hidePicker}
/>
</View>
);
};

const styles = StyleSheet.create({
container: {
const style = StyleSheet.create({
root: {
flex: 1,
justifyContent: "center",
alignItems: "center"
},
text: {
marginVertical: 10
}
});

export default App;
59 changes: 55 additions & 4 deletions example/android/app/build.gradle
Expand Up @@ -18,6 +18,9 @@ import com.android.build.OutputFile
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
Expand Down Expand Up @@ -73,7 +76,8 @@ import com.android.build.OutputFile
*/

project.ext.react = [
entryFile: "index.js"
entryFile: "index.js",
enableHermes: false, // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"
Expand All @@ -93,6 +97,28 @@ def enableSeparateBuildPerCPUArchitecture = false
*/
def enableProguardInReleaseBuilds = false

/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'

/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);

android {
compileSdkVersion rootProject.ext.compileSdkVersion

Expand All @@ -117,7 +143,13 @@ android {
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
Expand All @@ -126,21 +158,38 @@ android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}

}
}

packagingOptions {
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules

if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}

// Run this once to be able to run the application with BUCK
Expand All @@ -149,3 +198,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
7 changes: 0 additions & 7 deletions example/android/app/proguard-rules.pro
Expand Up @@ -8,10 +8,3 @@
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
@@ -1,14 +1,16 @@
package com.example;

import android.app.Application;
import android.util.Log;

import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {
Expand All @@ -21,9 +23,11 @@ public boolean getUseDeveloperSupport() {

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}

@Override
Expand Down
1 change: 1 addition & 0 deletions example/android/app/src/main/res/values/styles.xml
Expand Up @@ -3,6 +3,7 @@
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>

</resources>
13 changes: 9 additions & 4 deletions example/android/build.gradle
Expand Up @@ -13,7 +13,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath("com.android.tools.build:gradle:3.4.1")

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -23,11 +23,16 @@ buildscript {
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}

google()
jcenter()
}
}
3 changes: 3 additions & 0 deletions example/android/gradle.properties
Expand Up @@ -16,3 +16,6 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

android.useAndroidX=true
android.enableJetifier=true
Binary file modified example/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip

0 comments on commit d894a83

Please sign in to comment.