Skip to content

Commit 878e1dc

Browse files
committed
update example project to yarn and fix eslint issues
1 parent 7722bf9 commit 878e1dc

File tree

11 files changed

+5541
-11975
lines changed

11 files changed

+5541
-11975
lines changed

Example/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
root: true,
33
extends: '@react-native-community',
4-
};
4+
};

Example/App.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React, { Component } from 'react';
2-
import { StyleSheet, SafeAreaView, View } from 'react-native';
1+
import React, {Component} from 'react';
2+
import {StyleSheet, SafeAreaView, View} from 'react-native';
33
import DropdownAlert from 'react-native-dropdownalert';
4-
import { PURPLE_COLOR, WHITE_COLOR, ITEMS, ReactNativeLogo } from './constants';
4+
import {PURPLE_COLOR, WHITE_COLOR, ITEMS, ReactNativeLogo} from './constants';
55
import List from './List';
66
const InfoIcon = require('./assets/info.png');
77

88
export default class App extends Component {
9-
_onSelect({ item, index }) {
9+
_onSelect({item, index}) {
1010
switch (item.type) {
1111
case 'close':
1212
this._onProgrammaticClose();
@@ -15,17 +15,17 @@ export default class App extends Component {
1515
const interval = Math.floor(Math.random() * 4000 + 1);
1616
const title = `${item.type} \ncloses in ${interval / 1000} seconds`;
1717
// local image source
18-
let payload = { message: 'HelloWorld', source: InfoIcon };
19-
if (index % 2 == 0) {
18+
let payload = {message: 'HelloWorld', source: InfoIcon};
19+
if (index % 2 === 0) {
2020
// remote image source
21-
payload = { message: 'HelloWorld', source: ReactNativeLogo };
21+
payload = {message: 'HelloWorld', source: ReactNativeLogo};
2222
}
2323
this.dropDownAlertRef.alertWithType(
2424
item.type,
2525
title,
2626
item.message,
2727
payload,
28-
interval
28+
interval,
2929
);
3030
}
3131
}
@@ -45,10 +45,13 @@ export default class App extends Component {
4545
return (
4646
<View style={styles.container}>
4747
<SafeAreaView>
48-
<List items={ITEMS} onSelect={({ item, index }) => this._onSelect({ item, index })} />
48+
<List
49+
items={ITEMS}
50+
onSelect={({item, index}) => this._onSelect({item, index})}
51+
/>
4952
</SafeAreaView>
5053
<DropdownAlert
51-
ref={ref => this.dropDownAlertRef = ref}
54+
ref={ref => (this.dropDownAlertRef = ref)}
5255
containerStyle={{
5356
backgroundColor: PURPLE_COLOR,
5457
}}

Example/List.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React, { Component } from 'react';
2-
import { StyleSheet, Text, TouchableOpacity, FlatList } from 'react-native';
1+
import React, {Component} from 'react';
2+
import {StyleSheet, Text, TouchableOpacity, FlatList} from 'react-native';
33
import PropTypes from 'prop-types';
44

55
export default class List extends Component {
@@ -12,15 +12,19 @@ export default class List extends Component {
1212
onSelect: () => {},
1313
};
1414
render() {
15-
const { items, onSelect } = this.props;
15+
const {items, onSelect} = this.props;
1616
return (
1717
<FlatList
1818
keyExtractor={item => item.type}
1919
data={items}
20-
renderItem={({ item, index }) => {
20+
renderItem={({item, index}) => {
2121
return (
22-
<TouchableOpacity style={[styles.button, { borderColor: item.backgroundColor }]} onPress={() => onSelect({ item, index })}>
23-
<Text style={[styles.text, { color: item.backgroundColor }]}>{item.type}</Text>
22+
<TouchableOpacity
23+
style={[styles.button, {borderColor: item.backgroundColor}]}
24+
onPress={() => onSelect({item, index})}>
25+
<Text style={[styles.text, {color: item.backgroundColor}]}>
26+
{item.type}
27+
</Text>
2428
</TouchableOpacity>
2529
);
2630
}}

Example/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
## Installation
44

5-
* ```npm i -g react-native-cli```
65
* ```brew install node```
76
* ```brew install watchman```
7+
* ```brew install yarn```
88
* ```gem install cocoapods```
99

1010
## Up and running
1111

1212
1. Navigate to Example directory (```cd ~/Example```).
13-
2. Install dependencies: ```npm i --save```.
14-
3. Install iOS cocoapods: ```cd ios && pod install```
15-
4. Start Metro Bundler: ```npm start```.
16-
5. For iOS,```npm run ios```. For Android, start an emulator then, do ```npm run android```.
13+
2. Install dependencies: ```yarn```.
14+
3. Install iOS cocoapods dependencies: ```cd ios && pod install```
15+
4. Start Metro Bundler: ```yarn start```.
16+
5. For iOS, ```yarn ios```. For Android, start an emulator then, do ```yarn android```.
1717

1818
## Resources
1919

20-
* <http://facebook.github.io/react-native/docs/getting-started.html>
20+
* <https://reactnative.dev/docs/getting-started.html>

Example/babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
22
presets: ['module:metro-react-native-babel-preset'],
3-
};
3+
};

Example/constants.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,34 @@ export const ITEMS = [
44
{
55
backgroundColor: '#2B73B6',
66
type: 'info',
7-
message: "System is going down at 12 AM tonight for routine maintenance. We'll notify you when the system is back online.",
7+
message:
8+
"System is going down at 12 AM tonight for routine maintenance. We'll notify you when the system is back online.",
89
},
910
{
1011
backgroundColor: '#cd853f',
1112
type: 'warn',
12-
message: 'Your cloud drive is about to reach capacity. Please consider upgrading to premium plan.',
13+
message:
14+
'Your cloud drive is about to reach capacity. Please consider upgrading to premium plan.',
1315
},
1416
{
1517
backgroundColor: '#cc3232',
1618
type: 'error',
17-
message: "Sorry, we're having some technical difficulties. Our team will get this fixed for you ASAP.",
19+
message:
20+
"Sorry, we're having some technical difficulties. Our team will get this fixed for you ASAP.",
1821
},
1922
{
2023
backgroundColor: '#32A54A',
2124
type: 'success',
22-
message: "Thank you for your order. We will email and charge you when it's on it's way.",
25+
message:
26+
"Thank you for your order. We will email and charge you when it's on it's way.",
2327
},
2428
{
2529
backgroundColor: PURPLE_COLOR,
2630
type: 'custom',
27-
message: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
31+
message:
32+
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
2833
},
29-
{ backgroundColor: '#202020', type: 'close', title: 'close' },
34+
{backgroundColor: '#202020', type: 'close', title: 'close'},
3035
];
31-
export const ReactNativeLogo = 'https://facebook.github.io/react-native/docs/assets/favicon.png';
36+
export const ReactNativeLogo =
37+
'https://reactnative.dev/docs/assets/favicon.png';

Example/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { AppRegistry } from 'react-native';
1+
import {AppRegistry} from 'react-native';
22
import App from './App';
3-
AppRegistry.registerComponent('DropDownAlert', () => App );
3+
AppRegistry.registerComponent('DropDownAlert', () => App);

Example/ios/Podfile.lock

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ DEPENDENCIES:
250250
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
251251

252252
SPEC REPOS:
253-
https://github.com/cocoapods/specs.git:
253+
https://github.com/CocoaPods/Specs.git:
254254
- boost-for-react-native
255255

256256
EXTERNAL SOURCES:
@@ -308,31 +308,31 @@ EXTERNAL SOURCES:
308308
SPEC CHECKSUMS:
309309
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
310310
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
311-
FBLazyVector: cb37b5590a27600f0a889222d7c1f019625f4168
312-
FBReactNativeSpec: 6fda0eee5b059ee8ea0f845f4060620ff96b5b55
311+
FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f
312+
FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75
313313
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
314314
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
315-
RCTRequired: 81db8debffc2eb932841fa02dcf5a2e911af74c1
316-
RCTTypeSafety: 39a7d8643abe2460aef0adeb9acbe9401b579fff
317-
React: 89f2294058332cf7c4feee644e17d5024da1f531
318-
React-Core: c55956aa434fae94816b665f99d51d50f48d5993
319-
React-CoreModules: c70b9db4f48e31474bb022716fff41983b335ce2
320-
React-cxxreact: 1dbe583c02d15d269f13451d203e645bb233fc96
321-
React-jsi: f9126dd5818fbd8fbf869be9bbc1c0543973e1a1
322-
React-jsiexecutor: 752f034d0f007d1141a1c52ba9ef3fd9668fbfa7
323-
React-jsinspector: 044105eea064aec81adc5e4d777a8f6589e7d094
324-
React-RCTActionSheet: 49433f6e3659ba5d3ee650e44b9c18743ef9a7fc
325-
React-RCTAnimation: 12f86a4e3542032329366b03bca2cc254a7c64a9
326-
React-RCTBlob: ba90a4144ad478a022b79a4e8a1f150548d39425
327-
React-RCTImage: f652d97e49f4b0f26c7df336e723a0d259179967
328-
React-RCTLinking: e738422857085a1c40c57505a25920160d365783
329-
React-RCTNetwork: d0d635ad07deed0c05a1b1499d1ab4ce5c41ac97
330-
React-RCTSettings: ae6f8b64ee5c5e4fc629f5109042e122fd0fd14b
331-
React-RCTText: 3f24042210886ee8c02613758013010be04b291e
332-
React-RCTVibration: d55e1365be416980217914fe009e9d55dec02e03
333-
ReactCommon: eb96b70a2a5bed775e919151fd77699fed52944c
334-
Yoga: 6af72bedeaea291a3a3717772d6d41836f23a1b9
315+
RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1
316+
RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320
317+
React: b6a59ef847b2b40bb6e0180a97d0ca716969ac78
318+
React-Core: 688b451f7d616cc1134ac95295b593d1b5158a04
319+
React-CoreModules: d04f8494c1a328b69ec11db9d1137d667f916dcb
320+
React-cxxreact: d0f7bcafa196ae410e5300736b424455e7fb7ba7
321+
React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7
322+
React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
323+
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
324+
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
325+
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
326+
React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72
327+
React-RCTImage: 6b8e8df449eb7c814c99a92d6b52de6fe39dea4e
328+
React-RCTLinking: 121bb231c7503cf9094f4d8461b96a130fabf4a5
329+
React-RCTNetwork: fb353640aafcee84ca8b78957297bd395f065c9a
330+
React-RCTSettings: 8db258ea2a5efee381fcf7a6d5044e2f8b68b640
331+
React-RCTText: 9ccc88273e9a3aacff5094d2175a605efa854dbe
332+
React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad
333+
ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd
334+
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
335335

336336
PODFILE CHECKSUM: 36b2d0b2ab69ee63e220c20b6d9ed8eb11f687e6
337337

338-
COCOAPODS: 1.5.3
338+
COCOAPODS: 1.8.4

0 commit comments

Comments
 (0)