Skip to content

Commit

Permalink
chore: Run formatters
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven0351 committed Sep 18, 2023
1 parent 175dc94 commit 825a7b2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{js,ts,tsx,jsx}]
indent_size = 2
2 changes: 1 addition & 1 deletion example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
bracketSpacing: true,
singleQuote: true,
trailingComma: 'all',
};
15 changes: 12 additions & 3 deletions example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,21 @@ const portal = {

addPortal(portal);

const PubSubLabel: React.FC<{ initialNumber: number }> = ({ initialNumber }) => {
const PubSubLabel: React.FC<{ initialNumber: number }> = ({
initialNumber,
}) => {
const isDarkMode = useColorScheme() === 'dark';
const [immutableNumber, setNumber] = useState(initialNumber);
const subRef = useRef<EmitterSubscription | null>(null);
const number = useRef(initialNumber);

useEffect(() => {
subRef.current = subscribe('button:tapped', (message: Message) => {
console.log(`Received message ${JSON.stringify(message.data, null, 2)} on topic ${message.topic} from IonicPortals`);
console.log(
`Received message ${JSON.stringify(message.data, null, 2)} on topic ${
message.topic
} from IonicPortals`,
);

number.current = number.current + 1;
setNumber(number.current);
Expand Down Expand Up @@ -135,7 +141,10 @@ const App = () => {
backgroundColor: isDarkMode ? Colors.black : Colors.white,
}}>
<PubSubLabel initialNumber={1} />
<PortalView portal={{ name: "button" }} style={{ flex: 1, height: 150 }} />
<PortalView
portal={{ name: 'button' }}
style={{ flex: 1, height: 150 }}
/>
<Section title="Step One">
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
screen and then come back to see your edits.
Expand Down
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ export const subscribe = (
topic: string,
onMessageReceived: (message: Message) => void
): EmitterSubscription => {
return PortalsPubSub.addListener(`PortalsSubscription:${topic}`, (message: Message) => {
onMessageReceived(message)
});
return PortalsPubSub.addListener(
`PortalsSubscription:${topic}`,
(message: Message) => {
onMessageReceived(message);
}
);
};

/**
Expand Down

0 comments on commit 825a7b2

Please sign in to comment.