mirror of https://github.com/jitsi/jitsi-meet
ref(ui-components) Improve native and web Switch (#12061)
Bring Switch component more in line Convert some files to TSpull/12062/head jitsi-meet_7698
parent
6d39d13af7
commit
8dd71a921b
@ -0,0 +1,35 @@ |
||||
import React from 'react'; |
||||
import { ColorValue } from 'react-native'; |
||||
import { Switch as NativeSwitch } from 'react-native-paper'; |
||||
|
||||
import { SwitchProps } from '../types'; |
||||
|
||||
interface Props extends SwitchProps { |
||||
|
||||
/** |
||||
* Custom styles for the switch. |
||||
*/ |
||||
style?: Object; |
||||
|
||||
/** |
||||
* Color of the switch button. |
||||
*/ |
||||
thumbColor?: ColorValue; |
||||
|
||||
/** |
||||
* Color of the switch background. |
||||
*/ |
||||
trackColor?: Object; |
||||
} |
||||
|
||||
const Switch = ({ checked, disabled, onChange, thumbColor, trackColor, style }: Props) => ( |
||||
<NativeSwitch |
||||
disabled = { disabled } |
||||
onValueChange = { onChange } |
||||
style = { style } |
||||
thumbColor = { thumbColor } |
||||
trackColor = { trackColor } |
||||
value = { checked } /> |
||||
); |
||||
|
||||
export default Switch; |
@ -1,5 +1,3 @@ |
||||
// @flow
|
||||
|
||||
export const COMMAND_NEW_POLL = 'new-poll'; |
||||
export const COMMAND_ANSWER_POLL = 'answer-poll'; |
||||
export const COMMAND_OLD_POLLS = 'old-polls'; |
@ -1,66 +1,64 @@ |
||||
// @flow
|
||||
|
||||
export type Answer = { |
||||
|
||||
/** |
||||
* ID of the voter for this answer. |
||||
* An array of boolean: true if the answer was chosen by the responder, else false. |
||||
*/ |
||||
voterId: string, |
||||
answers: Array<boolean>, |
||||
|
||||
/** |
||||
* Name of the voter. |
||||
* ID of the parent Poll of this answer. |
||||
*/ |
||||
voterName: string, |
||||
pollId: string, |
||||
|
||||
/** |
||||
* ID of the parent Poll of this answer. |
||||
* ID of the voter for this answer. |
||||
*/ |
||||
pollId: string, |
||||
voterId: string, |
||||
|
||||
/** |
||||
* An array of boolean: true if the answer was chosen by the responder, else false. |
||||
* Name of the voter. |
||||
*/ |
||||
answers: Array<boolean> |
||||
voterName: string |
||||
}; |
||||
|
||||
export type Poll = { |
||||
|
||||
/** |
||||
* Whether the poll vote is being edited/changed. |
||||
* An array of answers: |
||||
* the name of the answer name and a map of ids and names of voters voting for this option. |
||||
*/ |
||||
changingVote: boolean, |
||||
answers: Array<{ name: string, voters: Map<string, string> }>, |
||||
|
||||
/** |
||||
* ID of the sender of this poll. |
||||
* Whether the poll vote is being edited/changed. |
||||
*/ |
||||
senderId: string, |
||||
changingVote: boolean, |
||||
|
||||
|
||||
/** |
||||
* Name of the sender of this poll |
||||
* Store poll sender name in case they exit the call. |
||||
* The last sent votes for this poll, or null if voting was skipped |
||||
* Note: This is reset when voting/skipping, not when clicking "Change vote". |
||||
*/ |
||||
senderName: string, |
||||
lastVote: Array<boolean> | null, |
||||
|
||||
/** |
||||
* Whether the results should be shown instead of the answer form. |
||||
* The question asked by this poll. |
||||
*/ |
||||
showResults: boolean, |
||||
question: string, |
||||
|
||||
/** |
||||
* The last sent votes for this poll, or null if voting was skipped |
||||
* Note: This is reset when voting/skipping, not when clicking "Change vote". |
||||
* ID of the sender of this poll. |
||||
*/ |
||||
lastVote: Array<boolean> | null, |
||||
senderId: string, |
||||
|
||||
/** |
||||
* The question asked by this poll. |
||||
* Name of the sender of this poll |
||||
* Store poll sender name in case they exit the call. |
||||
*/ |
||||
question: string, |
||||
senderName: string, |
||||
|
||||
/** |
||||
* An array of answers: |
||||
* the name of the answer name and a map of ids and names of voters voting for this option. |
||||
* Whether the results should be shown instead of the answer form. |
||||
*/ |
||||
answers: Array<{ name: string, voters: Map<string, string> }>, |
||||
showResults: boolean |
||||
}; |
Loading…
Reference in new issue