Skip to content

Commit 666e0fe

Browse files
committed
fix: moved jsx -> js, fixed eslint rules
1 parent 3a476cb commit 666e0fe

File tree

9 files changed

+54
-63
lines changed

9 files changed

+54
-63
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AppRegistry } from 'react-native';
1+
import {AppRegistry} from 'react-native';
22
import App from './src/App';
33

44
AppRegistry.registerComponent('main', () => App);

example/metro.config.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
const path = require('path');
22
const escape = require('escape-string-regexp');
33
const exclusionList = require('metro-config/src/defaults/exclusionList');
4+
const _ = require('underscore');
45
const pak = require('../package.json');
56

67
const root = path.resolve(__dirname, '..');
78

8-
const modules = Object.keys({
9+
const modules = _.keys({
910
...pak.peerDependencies,
1011
});
1112

@@ -17,19 +18,17 @@ module.exports = {
1718
// So we block them at the root, and alias them to the versions in example's node_modules
1819
resolver: {
1920
blacklistRE: exclusionList(
20-
modules.map(
21-
m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
22-
),
21+
_.map(modules, m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)),
2322
),
2423

25-
extraNodeModules: modules.reduce((acc, name) => {
24+
extraNodeModules: _.reduce(modules, (acc, name) => {
2625
acc[name] = path.join(__dirname, 'node_modules', name);
2726
return acc;
2827
}, {}),
2928
},
3029

3130
transformer: {
32-
getTransformOptions: async () => ({
31+
getTransformOptions: () => ({
3332
transform: {
3433
experimentalImportSupport: false,
3534
inlineRequires: true,

example/src/App.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import * as React from 'react';
2+
import {View} from 'react-native';
3+
import {multiply} from 'react-native-key-command';
4+
5+
export default function App() {
6+
React.useEffect(() => {
7+
multiply(3, 7);
8+
}, []);
9+
10+
return (
11+
<View />
12+
);
13+
}
14+

example/src/App.jsx

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

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,8 @@
117117
"commonjs",
118118
"module"
119119
]
120+
},
121+
"dependencies": {
122+
"underscore": "^1.13.4"
120123
}
121124
}

src/__tests__/index.test.jsx

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/index.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {NativeModules, Platform} from 'react-native';
2+
3+
const PLATFORM_ERROR_MESSAGE = Platform.select({ios: "- You have run 'pod install'\n", default: ''});
4+
const LINKING_ERROR = `The package 'react-native-key-command' doesn't seem to be linked. Make sure: \n\n
5+
${PLATFORM_ERROR_MESSAGE}\n
6+
- You rebuilt the app after installing the package\n
7+
- You are not using Expo managed workflow\n`;
8+
9+
const KeyCommand = NativeModules.KeyCommand ? NativeModules.KeyCommand : new Proxy(
10+
{},
11+
{
12+
get() {
13+
throw new Error(LINKING_ERROR);
14+
},
15+
},
16+
);
17+
18+
function constants() {
19+
return KeyCommand.constants();
20+
}
21+
22+
function multiply(a, b) {
23+
return KeyCommand.multiply(a, b);
24+
}
25+
26+
export {multiply, constants};

src/index.jsx

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

0 commit comments

Comments
 (0)