-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-distributed.js
More file actions
39 lines (35 loc) · 781 Bytes
/
Copy pathtest-distributed.js
File metadata and controls
39 lines (35 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const babel = require('@babel/core');
const plugin = require('./dist/index.js');
const code = `
import React from 'react';
import { View, Text } from 'react-native';
export const DistLayout = () => {
return (
<View className="justify-between flex-row">
<Text>Left</Text>
<Text>Right</Text>
</View>
);
};
export const MiddleDistLayout = () => {
return (
<View style={{ justifyContent: 'space-around' }}>
<Text>First</Text>
<View>
<Text>Middle</Text>
</View>
<Text>Last</Text>
</View>
);
};
`;
babel.transform(code, {
presets: ['@babel/preset-react'],
plugins: [[plugin, { trailingSpaces: true }]]
}, (err, result) => {
if (err) {
console.error(err);
} else {
console.log(result.code);
}
});