Skip to content

Typescript/feature highlight #1338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,22 @@ const messages = [
'Here is where you can view demos of all Uilib components'
];

class FeatureHighlightScreen extends Component {
constructor(props) {
interface State {
currentTargetIndex: number;
showFTE: boolean;
}

class FeatureHighlightScreen extends Component<{}, State> {
viewRef: any;
targets: {[key: string]: any} = {};

constructor(props: any) {
super(props);

this.state = {
showFTE: false,
currentTargetIndex: 0
};

this.targets = {};
}

componentDidMount() {
Expand All @@ -46,7 +52,7 @@ class FeatureHighlightScreen extends Component {
this.setState({showFTE: false}, () => {
if (this.viewRef) {
const reactTag = findNodeHandle(this.viewRef);
AccessibilityInfo.setAccessibilityFocus(reactTag);
reactTag && AccessibilityInfo.setAccessibilityFocus(reactTag);
}
});
};
Expand All @@ -55,7 +61,7 @@ class FeatureHighlightScreen extends Component {
this.setState({showFTE: true});
};

addTarget(ref, id) {
addTarget(ref: any, id: string) {
if (ref && !this.targets[id]) {
this.targets[id] = ref;
}
Expand All @@ -68,7 +74,7 @@ class FeatureHighlightScreen extends Component {
this.moveToPage(newTargetIndex);
};

moveToPage(index) {
moveToPage(index: number) {
if (index < _.size(this.targets)) {
this.setState({currentTargetIndex: index});
} else {
Expand All @@ -87,7 +93,7 @@ class FeatureHighlightScreen extends Component {
};
}

onPagePress = index => {
onPagePress = (index: number) => {
this.moveToPage(index);
};

Expand Down
5 changes: 2 additions & 3 deletions src/components/featureHighlight/__tests__/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import {updateConstants} from '../../../helpers/Constants';
import {testable as FeatureHighlight} from '../';

describe('FeatureHighlight', () => {
let FeatureHighlight;

beforeEach(() => {
mockScreenDimentions();
FeatureHighlight = require('../index').default;
});

describe('getContentPosition', () => {
it('massage should be placed above element positioned below screen\'s vertical center', () => {
const uut = new FeatureHighlight({});
const uut = new FeatureHighlight({visible: true});
uut.state = {
contentTopPosition: 0
};
Expand Down
Loading