Skip to content

Commit 3cc6da9

Browse files
committed
Merge branch 'feature/issue-33'
# Conflicts: # src/lib/renderRules.js
2 parents 11f45ee + e047c8c commit 3cc6da9

File tree

80 files changed

+10442
-483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+10442
-483
lines changed

bin/data.json

Lines changed: 529 additions & 0 deletions
Large diffs are not rendered by default.

example/.babelrc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
{
2-
"presets": ["babel-preset-expo"],
3-
"env": {
4-
"development": {
5-
"plugins": ["transform-react-jsx-source"]
6-
}
7-
}
2+
"presets": ["react-native"]
83
}

example/.buckconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

example/.flowconfig

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,43 @@
1212
; For RN Apps installed via npm, "Libraries" folder is inside
1313
; "node_modules/react-native" but in the source repo it is in the root
1414
.*/Libraries/react-native/React.js
15-
.*/Libraries/react-native/ReactNative.js
1615

17-
; Additional create-react-native-app ignores
16+
; Ignore polyfills
17+
.*/Libraries/polyfills/.*
1818

19-
; Ignore duplicate module providers
20-
.*/node_modules/fbemitter/lib/*
21-
22-
; Ignore misbehaving dev-dependencies
23-
.*/node_modules/xdl/build/*
24-
.*/node_modules/reqwest/tests/*
25-
26-
; Ignore missing expo-sdk dependencies (temporarily)
27-
; https://github.com/expo/expo/issues/162
28-
.*/node_modules/expo/src/*
29-
30-
; Ignore react-native-fbads dependency of the expo sdk
31-
.*/node_modules/react-native-fbads/*
19+
; Ignore metro
20+
.*/node_modules/metro/.*
3221

3322
[include]
3423

3524
[libs]
3625
node_modules/react-native/Libraries/react-native/react-native-interface.js
37-
node_modules/react-native/flow
38-
flow/
26+
node_modules/react-native/flow/
27+
node_modules/react-native/flow-github/
3928

4029
[options]
41-
module.system=haste
42-
4330
emoji=true
4431

45-
experimental.strict_type_args=true
32+
module.system=haste
4633

4734
munge_underscores=true
4835

4936
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
5037

38+
module.file_ext=.js
39+
module.file_ext=.jsx
40+
module.file_ext=.json
41+
module.file_ext=.native.js
42+
5143
suppress_type=$FlowIssue
5244
suppress_type=$FlowFixMe
53-
suppress_type=$FixMe
45+
suppress_type=$FlowFixMeProps
46+
suppress_type=$FlowFixMeState
5447

55-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
56-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
49+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
5750
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
5851
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
5952

60-
unsafe.enable_getters_and_setters=true
61-
6253
[version]
63-
^0.49.1
54+
^0.67.0

example/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

example/.gitignore

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,56 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
project.xcworkspace
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
33+
# node.js
34+
#
135
node_modules/
2-
.expo/
3-
npm-debug.*
4-
/package-lock.json
5-
/react-native-markdown-renderer
36+
npm-debug.log
37+
yarn-error.log
38+
39+
# BUCK
40+
buck-out/
41+
\.buckd/
42+
*.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle

example/.watchmanconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

example/App.js

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,47 @@
1-
import React, {Component} from "react";
2-
import {Picker, ScrollView, StyleSheet, Text, View} from "react-native";
1+
/**
2+
* Sample React Native App
3+
* https://github.com/facebook/react-native
4+
*/
5+
6+
import React, { Component } from 'react';
7+
import { Platform, Picker, ScrollView, StyleSheet, Text, View, Alert } from 'react-native';
8+
39
import Markdown, {
4-
AstRenderer, getUniqueID, PluginContainer, renderRules,
5-
styles
6-
} from "./react-native-markdown-renderer";
10+
AstRenderer,
11+
getUniqueID,
12+
PluginContainer,
13+
renderRules,
14+
styles,
15+
} from './react-native-markdown-renderer';
16+
//
17+
import markdownItCheckbox from 'markdown-it-checkbox';
18+
import copyAll from './src/copyAll';
19+
import customMarkdownStyle from './src/customMarkdownStyle';
20+
import copyAllCheckboxPlugin from './src/copyAllCheckboxPlugin';
21+
import pluginRules from './src/pluginRules';
722

8-
import markdownItCheckbox from "markdown-it-checkbox";
9-
import copyAll from "./src/copyAll";
10-
import customMarkdownStyle from "./src/customMarkdownStyle";
11-
import copyAllCheckboxPlugin from "./src/copyAllCheckboxPlugin";
12-
import pluginRules from "./src/pluginRules";
23+
const instructions = Platform.select({
24+
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
25+
android: 'Double tap R on your keyboard to reload,\n' + 'Shake or press menu button for dev menu',
26+
});
1327

1428
const rules = {
1529
// added custom block element defined by plugin
1630
block: (node, children, parents, style) => {
1731
return (
18-
<Text key={getUniqueID()} style={{ backgroundColor: "green" }}>
32+
<Text key={getUniqueID()} style={{ backgroundColor: 'green' }}>
1933
{children}
2034
</Text>
2135
);
2236
},
2337

2438
checkbox: (node, children, parents, style) => {
2539
return (
26-
<Text key={getUniqueID()} style={{ backgroundColor: "green" }}>
40+
<Text key={getUniqueID()} style={{ backgroundColor: 'green' }}>
2741
{children}
2842
</Text>
2943
);
30-
}
44+
},
3145
};
3246

3347
/**
@@ -36,23 +50,23 @@ const rules = {
3650
const renderer = new AstRenderer(
3751
{
3852
...renderRules,
39-
...rules
53+
...rules,
4054
},
4155
styles
4256
);
4357

4458
export default class App extends Component {
4559
state = {
46-
view: 5
60+
view: 0,
4761
};
4862

4963
list = [
50-
{ description: "default" },
51-
{ description: "custom renderer" },
52-
{ description: "custom style sheet" },
53-
{ description: "custom rules" },
54-
{ description: "custom rules & styles" },
55-
{ description: "plugins (checkbox)" },
64+
{ description: 'default' },
65+
{ description: 'custom renderer' },
66+
{ description: 'custom style sheet' },
67+
{ description: 'custom rules' },
68+
{ description: 'custom rules & styles' },
69+
{ description: 'plugins (checkbox)' },
5670
];
5771

5872
getView(value) {
@@ -70,21 +84,13 @@ export default class App extends Component {
7084
return <Markdown rules={rules} children={copyAll} />;
7185
}
7286
case 4: {
73-
return (
74-
<Markdown
75-
rules={rules}
76-
style={customMarkdownStyle}
77-
children={copyAll}
78-
/>
79-
);
87+
return <Markdown rules={rules} style={customMarkdownStyle} children={copyAll} />;
8088
}
8189
case 5: {
8290
return (
8391
<Markdown
8492
rules={pluginRules}
85-
plugins={[
86-
new PluginContainer(markdownItCheckbox, { divWrap: true })
87-
]}
93+
plugins={[new PluginContainer(markdownItCheckbox, { divWrap: true })]}
8894
style={customMarkdownStyle}
8995
children={copyAllCheckboxPlugin}
9096
/>
@@ -97,25 +103,20 @@ export default class App extends Component {
97103
}
98104
}
99105

106+
handleChangeValue = (itemValue, itemIndex) => {
107+
this.setState({ view: itemIndex });
108+
};
109+
100110
render() {
111+
let currentView = this.state.view;
112+
101113
return (
102114
<View style={styleSheet.container}>
103-
<Picker
104-
selectedValue={this.state.view}
105-
onValueChange={(itemValue, itemIndex) =>
106-
this.setState({ view: itemIndex })
107-
}
108-
>
109-
{this.list.map((val, index) => (
110-
<Picker.Item
111-
key={val.description}
112-
label={val.description}
113-
value={index}
114-
/>
115-
))}
115+
<Text>{currentView}</Text>
116+
<Picker selectedValue={currentView} onValueChange={this.handleChangeValue}>
117+
{this.list.map((val, index) => <Picker.Item key={val.description} label={val.description} value={index} />)}
116118
</Picker>
117-
118-
<ScrollView>{this.getView(this.state.view)}</ScrollView>
119+
<ScrollView>{this.getView(currentView)}</ScrollView>
119120
</View>
120121
);
121122
}
@@ -124,6 +125,6 @@ export default class App extends Component {
124125
const styleSheet = StyleSheet.create({
125126
container: {
126127
flex: 1,
127-
marginTop: 20
128-
}
128+
marginTop: 20,
129+
},
129130
});

example/App.test.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)